Re: [twsocket] TWsocket connection error 10048
So This leads me to think that TWSocket is not closing/freeing/de-allocating the LocalPort, such that when I try to reopen the connection a few seconds after I close it, windows raises the 10048 error due to the LocalPort still being allocated Is this the case No, it isn't. But Windows TCP/IP stack does that. Try setting ReuseAddr property to true. Is there something else I need to call ?? Why would you assign LocalPort ? As I said in previous message, DO NOT ASSIGN LocalPort property. To connect to a remote host, only the (remote) Port is important. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] TWsocket connection error 10048
Hi... Quote: >When you don't assign the LocalPort, Windows automatically assign an >available local port. This is usually what is done for connecting to a >remote host. If you have any reason not to do so, just explain why. If I use this code: TheTCPClientSocket->Addr = TCP_ClientAddress; TheTCPClientSocket->Proto = "tcp"; TheTCPClientSocket->Port = TCP_ClientPort; TheTCPClientSocket->LocalPort = TCP_ClientPort; TheTCPClientSocket->Connect(); Then I can connect OK, but the second time I connect I get the 10048 if done a few seconds after I close the connection - if I wait 1 minute after I disconnect and then reconnect, all is OK If I use this code: TheTCPClientSocket->Addr = TCP_ClientAddress; TheTCPClientSocket->Proto = "tcp"; TheTCPClientSocket->Port = TCP_ClientPort; TheTCPClientSocket->Connect(); Then I can connect, disconnect and then reconnect many times over a 1 minute period === So This leads me to think that TWSocket is not closing/freeing/de-allocating the LocalPort, such that when I try to reopen the connection a few seconds after I close it, windows raises the 10048 error due to the LocalPort still being allocated Is this the case This is the code called when I want to close the Client connection TheTCPClientSocket->Close(); Is there something else I need to call ?? Thanks Ray -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] TWsocket connection error 10048
I have got to the bottom of the Error 10048 This means the port you are trying to use is already used and thus is no more available. It seems that the order in witch you assign values to the TWSocket properties when you want to open a client is important - so now I can open and close the client heaps of times with out the error 10048 being raised :-) The code I was using looked like this TheTCPClientSocket->Proto = "tcp"; TheTCPClientSocket->Port= TCP_ClientPort; TheTCPClientSocket->Addr= TCP_ClientAddress; TheTCPClientSocket->LocalPort = TCP_ClientPort; TheTCPClientSocket->LocalAddr = "0.0.0.0"; TheTCPClientSocket->Connect(); The correct code that works looks like this TheTCPClientSocket->Addr= TCP_ClientAddress; TheTCPClientSocket->Proto = "tcp"; TheTCPClientSocket->Port= TCP_ClientPort; TheTCPClientSocket->Connect(); Does anyone know why this is the case ??? When you don't assign the LocalPort, Windows automatically assign an available local port. This is usually what is done for connecting to a remote host. If you have any reason not to do so, just explain why. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] TWsocket connection error 10048
Hi... I have got to the bottom of the Error 10048 It seems that the order in witch you assign values to the TWSocket properties when you want to open a client is important - so now I can open and close the client heaps of times with out the error 10048 being raised :-) The code I was using looked like this TheTCPClientSocket->Proto = "tcp"; TheTCPClientSocket->Port= TCP_ClientPort; TheTCPClientSocket->Addr= TCP_ClientAddress; TheTCPClientSocket->LocalPort = TCP_ClientPort; TheTCPClientSocket->LocalAddr = "0.0.0.0"; TheTCPClientSocket->Connect(); The correct code that works looks like this TheTCPClientSocket->Addr= TCP_ClientAddress; TheTCPClientSocket->Proto = "tcp"; TheTCPClientSocket->Port= TCP_ClientPort; TheTCPClientSocket->Connect(); Does anyone know why this is the case ??? Hope this helps anyone else who is having this problem Regards Ray -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] TWsocket connection error 10048
RayA @ Ihug wrote: > When I call the TWSocket->Connect() for the first time every thing > works perfectly, the connection is made and data can be Rx'ed and > Tx'ed without problems > > then I call TWSocket->Close() > > and a few seconds later I call TWSocket->Connect() >- In the OnSessionConnected event I get the error 10048 Is there a reason for binding to a specific port number? Usually a connecting socket should be set to port number zero in order to allow winsock to find and assign an unused port number. Setting property ReuseAddr is dangerous since the port might be already bound by another application. In such case the behavior for all sockets bound to that port is indeterminate. http://msdn.microsoft.com/en-us/library/ms740621.aspx -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] TWsocket connection error 10048
Try setting the ReuseAddr property to true. This might help. Justin. -Original Message- From: twsocket-boun...@elists.org [mailto:twsocket-boun...@elists.org] On Behalf Of RayA @ Ihug Sent: Thursday, 31 March 2011 9:35 AM To: twsocket@elists.org Subject: [twsocket] TWsocket connection error 10048 Hi all... I am running on Windows XP, Embarcadero XE I am using the TWSocket Version:7.47 in Client mode to connect to another PC on my LAN which is also using TWSocket in Listen mode. When I call the TWSocket->Connect() for the first time every thing works perfectly, the connection is made and data can be Rx'ed and Tx'ed without problems then I call TWSocket->Close() and a few seconds later I call TWSocket->Connect() - In the OnSessionConnected event I get the error 10048 If instead of waiting a few seconds, I wait 1 minute then call the TWSocket->Connect() the connection is made and all works correctly - this error = "Cannot bind to an already used TCP Port" Is there some something you need to call after the Close() method before you call the TWSocket->Connect() method ??? = If I close the application, re-run it and try to connect, then the error 10048 still occurs !!! thanks for any help -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
[twsocket] TWsocket connection error 10048
Hi all... I am running on Windows XP, Embarcadero XE I am using the TWSocket Version:7.47 in Client mode to connect to another PC on my LAN which is also using TWSocket in Listen mode. When I call the TWSocket->Connect() for the first time every thing works perfectly, the connection is made and data can be Rx'ed and Tx'ed without problems then I call TWSocket->Close() and a few seconds later I call TWSocket->Connect() - In the OnSessionConnected event I get the error 10048 If instead of waiting a few seconds, I wait 1 minute then call the TWSocket->Connect() the connection is made and all works correctly - this error = "Cannot bind to an already used TCP Port" Is there some something you need to call after the Close() method before you call the TWSocket->Connect() method ??? = If I close the application, re-run it and try to connect, then the error 10048 still occurs !!! thanks for any help -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be