Networking – How to detect a server IP address from a client and connect to that server via TCP / IP?

Thank you for contributing an answer to Stack Overflow!

  • Please make sure to respond to the question. Provide details and share your research!

But to avoid

  • Ask for help, clarification, or answer other answers.
  • Make statements based on the opinion; save them with references or personal experience.

To learn more, read our tips for writing good answers.

MSSQL Intermittent TCP Connection Error When Using Linked Server (Linked to Connection Pool?)

I have four SQL Agent tasks that run constantly. Each job runs a stored procedure that queries recent ATM transactions, all via the same linked server. This occurs in a loop of each job with a delay of 5 seconds between executions (with WAITFOR DELAY).

Specifically, one of the four jobs uses a stored procedure and the other three use another. Each job run has its own set of parameters related to specific transaction patterns that will trigger a response. They all poll the same linked server.

Most of the time, everything works well. But occasionally (almost *) one of the jobs will fail with this error:

TCP Provider: The specified network name is no longer available. [SQLSTATE 42000] (Error 64) The OLE DB provider "SQLNCLI11" of the linked server "ATMDB" returned the message "Failed communication link". [SQLSTATE 01000] (Error 7412).

It only started after the jobs were updated to run continuously with the WAITFOR loop, rather than running once a minute as & # 39; Separate SQL Agent Job Execution. This change was made to avoid excessive logging of SQL jobs and to monitor ATM transactions much closer to real time.

There is no consistency with the frequency at which they will fail, but it is at least a few times a day.

* I say "almost" above because one of the jobs has never failed. It is the one that receives most often "occurrences". When this happens, the work step is allowed to end. So we have explicit logging in the SQL job logs. (He then returns to the first step after a 1 second delay.)

All jobs are configured to run every minute. Thus, after a breakdown, work will resume at the beginning of the next minute. This will not have a significant impact on things. It's just very annoying!

I suspect that the native SQL client and the way it implements bundling of connections are causing the problem. During testing, I updated the linked server in one of two procedures so that it was different from the other. Two different host names, but still the same server (I just use the hosts file to create a new name). This resulted in the failure of one job, but two of the other three jobs still failed intermittently. After changing the other procedure to use the same linked server again, all jobs fail again. Because connection pools are specific to the connection string, a different server name would result in the use of another pool.

With the help of the Windows Resource Monitor, I find that three TCP connections are usually open on the linked server. These remain open on the same ports for several minutes, so I guess it uses a connection pool type. When the error occurs, it coincides with the closing of one of the connections and, soon after, a new connection opens.

My current theory: Since the processes repeat themselves in loop when using the linked server, something about the connection pool causes a situation in which it tries to use a connection that has been closed for some reason. Perhaps the only work step that "ends" from time to time is refreshed one way or another and prevents the error from occurring on that specific process.

I've tried to encapsulate the procedure calls stored in sp_executesql as a workaround for "forcing" another process or execution context, but that did not help.

Both servers are Windows 2012 running on VMWare.

Any ideas on how to solve more?

websocket – No ACK packet for TCP SYN with a window scale of 64

I found a very strange problem. We found that the time required to establish the Websocket connection between the mobile phone and the server was too long. Then I use tcpdump to capture the data and discover that the problem may have something to do with the window scale option in the SYN package. Here is the SYN package for the websocket connection:

55488 → 443 [SYN] Seq = 0 Win = 65535 Len = 0 MSS = 1460 WS = 64 TSval = 570815281 TSecr = 0 SACK_PERM = 1

But the server did not respond with ack. Then, several retransmissions of SYN took place. Finally, the client sent a retransmission of SYN:

55488 → 443 [SYN] Seq = 0 Win = 65535 Len = 0 MSS = 1460 SACK_PERM = 1

Then the server responded with ack.

I have also captured other HTTP connection data and found that the window scale option in the SYN packet for the HTTP connection was "WS = 128". No retransmission occurs when establishing the connection for the HTTP connection.

So, I just want to know the reason for that. The operating system of our server is version 6.7 of CentOS. The kernel version is 2.6.32-573.el6.x86_64.

Problem Using TCP DNS Query on Service Does Not Support IPv6

  • Symptom
    After adding "use-vc options" in /etc/resolv.conf, tools such as wget / curl can no longer resolve the hostname. Dig / nslookup works. But if you change the name server to or, everything will work.
  • Research
    After TCPDump with the cross matrix of wget / nslookup / myDNS / I found it:

    1. wget performs IPv4 and IPv6 requests in one request; nslookup is only IPv4.
    2. returns IPv4 and IPv6 responses (resolved in CNAME, not IPv6 addresses) in one response; My DNS only returns IPv4.
    3. A test code calling getaddrinfo works the same way as wget.
  • Conclusion
    With TCP DNS, glibc continues to request both IPv4 and IPv6, if the response does not contain IPv6, it fails.

Question: Is it by design? Why?

How to configure Nginx to obtain proxy proxy for TCP IP visitors if the visitor uses an anonymous proxy?

I'm trying to configure Nginx to get the IP address of visitors if the latter uses an anonymous proxy. I understand that it is impossible with HTTP, but is there a way to catch the actual TCP IP users not hidden by an anonymous proxy?

firewalls – Detection and blocking of TCP VPN connections that bypasses existing VPN detection software

I help manage a small network of college campuses and students are not allowed to visit certain sites and download torrents. Currently, I am able to block UDP VPN connections, but TCP VPN connections are a little tricky. What are some methods to prevent users from using VPN connections to bypass these systems? Is there a service or software that can help you? How does the China firewall do it?

Linux firewall to disconnect inactive TCP connections after a wait timeout

My requirement is to disconnect inactive TCP connections (no keepalive probes either) more than x times (delay value), is this configuration possible with UFW? if not, can I configure such a rule in iptables? As I found on the Internet, it is possible with a Layer 2 hardware firewall, but what I want is to do it with a Linux tool

5th dnd – In Adventurers League (rules of season 8), is a consumable magical item found during the adventure unlocked to be purchased with TCP?

Suppose I play an AL adventure in which a potion to fly is found. I know that I or another character can keep this potion, use it during this adventure or keep it for a later adventure. But is the potion to fly unlocked for me to buy more with treasure checkpoints if I want to? This is on the magic D element table, which means that it would cost 16 TCP level 2 or higher.

Forward / Dual NiFi TCP Stream – Battery overflow

I am supposed to duplicate a binary TCP stream.

I have therefore set up a NiFi 1.9.0 server, a ListenTCP processor and a PutTCP processor, configured the appropriate IP addresses and ports and connected them.

Up to now everything is fine, the packets have been received by the ListenTCP processor and also canceled by the PutTCP processor.

But NiFi seems to play with the data, the packets sent are not exactly the same as those received. I was expecting NiFi to simply transmit everything 1: 1, but something is happening and I can not find what.

I had fun with the Character Set, Maximum Batch Size, and Batch Message Expander parameters of the ListenTCP processor, as well as with the outbound message digest and PutTCP character set.

I've also tinkered with a MergeContent processor but I have not made it work properly.

Here you can see the difference between the data received (in red) and the data sent (captured using tcpflow).
Link to the image

Another problem is that I do not really know the data I'm dealing with, it's written in the documentation:

These log files are in machine-readable binary format, described by the XML file called ebm.xml.


The broadcast events are in binary format based on TCP.

I have access to the ebm.xml file, but I do not know how to use it.

Anyone have an idea of ​​how I can get NiFi that simply sends?
I am new to NiFi, so I may have missed some possibilities …

terminal – How to block TCP connections from unidentified IP addresses mac

I started a private minecraft server for my friend and me, which forced me to use generic TCP transfer in order to open it to accept its IP address. I used this program called for the TCP transfer that opened my network to accept incoming connections. the command I'm using is the following

ssh -R (port number): localhost: (localhost number)

However, I also get random IP connections that I do not know like this one

besides, I'm pretty sure I can catch the viruses by opening the ports I use, even if the OSX firewall and avast antivirus are enabled. Is it possible to whitelist my friend's IP address and block all others? I am relatively new to server / port forwarding, so it would be very useful for someone to help you explain this, as well as any other steps you can take to prevent the receipt of viruses / Trojans / other malicious programs on the Internet.