TCP-connection remains in State "Connecting"
Hi,I'm ran into a problem with my LAN-application.
I'm connecting six applications over a LAN and for testing on one PC (using the loopbackIP). I have that running, but (out of a sudden?) I'm uable to connect a special type of the clients. Since all types are using the same code (server and clients are in the same EXE, identified by selectable type), and all are connecting good I'm a bit lost.
The Server is listening on a WinsockArray (indexNumber 0), LocalPort set 1360.
The Client is connecting to that port on an automaticly selceted socketHandle (setting 0).
The server does get the _ConnectionRequest on ArrayItem 0 (the SocketHandle is different from the Client-one, but that should be OK). The LocalPort and RemotePort-Settings are ViceVersa to the Client. In this event the server .Accepts the connection on a new ArrayItem (it won't work wether I try the problem client first last or any point in between, and I tried it after reboot as well). The state of the connection on the server side is now "connected".
The next thing i'd be looking forward would be the _Connect Event on the client side, but that doesn't happen! The state on the Clinet remains "connecting".
The only difference I could figure out between a connecting client and the problem one is that the problem client doesn't show the .RemoteHostIP.
The .RemoteHost is set by the code to "127.0.0.1" before connecting, for a good client the same value would show for .RemoteHostIP, but for he problem client this value remains empty.
Does anybody have an idea wherelese I could look!
Re: TCP-connection remains in State "Connecting"
two things:
you will get "connecting" if your ACL on your router / switch is enabled and filtering you. However, you connect, so you ACL might have a connection limit.
The possibility is you are hitting the connection limit of XP. Try running it on 2003.
{edit}
I just re-read your post. disregard the first thing. If it maps directly to 127.0.0.1, it shouldn't leave your network card, and it should just go through the loopback. however, hard coding it to the machine actually ip would leave your network card and come back.
Re: TCP-connection remains in State "Connecting"
Weird,
after having the Laptop been shutdown over night, the problem Clinet did get connected???? But only once, closing and than starting the the client again gave the "old" faulty result. I'm lost!
Re: TCP-connection remains in State "Connecting"
FOUND the problem!
Instead of having just:
Code:
WinsockTCP(0).Connect ServerIp, ServerPort
the following solved the problem.
Code:
Connected=False
WinsockTCP(0).Connect ServerIp, ServerPort
Do
DoEvents
Loop Until Connected=True
With this line added in the winsockTCP_Connect Event
Maybe al the problems I had, with clients not connecting "sometimes" (I even posted other threads in this :mad: ) could be solved by this one.