-
i am using the winsock control to do some simple communication between my applications. i have used it before with much success. however, my new application seems to be having trouble connecting. i get an address in use error, some of the time. some of the time i can connect. it is really wierd. i know how the control works and i have used it extensively, i have just never had this error come up so often before. any ideas.
thnx, jk
-
What port are you using...try somehting like 2000 to make sure no programs are using the port.
-
Hi,
Are you close the Winsock ? can you show your prog?
Regards
-
JJK,
It sounds like you aren't closing the winsock connections after you are done with them (Winsock1.Close). Try connecting to a diff port or pc and see if anything happens, it could be that you have too many connections open with that one comp.
Laterz,
D!m
-
I don't think closing it is the problem. I close the connection in the close event, I also close in the error event. I also have a timer going that after a minute it checks the connetion and if it is not connected it closes the winsock connection for the client, if the server is not connected then it is set to listen. So anyway, I got frustrated and went to the extreme. I made any array of 15 winsock controls, then whenever a connection is attempted it just loops through each of the controls and tries to connect. Once it finds one that connects, it exits the loop and continues to communicate. Since I did that I have had no troubles connecting.
I wonder, is there a way to find what port are available at any time on you machine. That sounds a little extreme, but it would be cool.
Thanks for the input,
JK