Re: How to close a blocked socket



On Jun 28, 7:12 am, "Diego F." <diego_f...@xxxxxxx> wrote:
Hello. I don't know how to force the closing of a blocked socket.

I have an server application that listens to a port. It works as it is very
simple, but I'm not sure about how to close the socket.

I use a thread to run the socket part, so I don't block the user interface.
If I close the application, and open again, the port is still in use.

I try to suspend the thread, but it doesn't work also.

How can I do that?

When you created the thread that manages the socket, did you set the
IsBackground flag to true? If you do that, the OS will terminate your
child threads when the main application closes.

http://msdn2.microsoft.com/en-us/library/system.threading.thread.isbackground.aspx

brian

.



Relevant Pages

  • Re: Definition of a socket on Suns website
    ... the server gets a new socket bound to a different port. ... It needs a new socket (and consequently a different port number) so that it can continue to listen to the original socket for connection requests while tending to the needs of the connected client. ...
    (comp.lang.java.programmer)
  • Re: socket communication: socket doesnt connect
    ... Microsoft MVP, MCSD ... As far as your server code goes, ... accept the listening socket. ... overlapped sockets with an I/O Completion Port. ...
    (microsoft.public.vc.language)
  • Re: millionth socket problem....
    ... > my client *is* working. ... > My server is the following, ... > use Socket; ... Your program worked for me, if I changed the port number to 7023, as ...
    (perl.beginners)
  • Re: Problem with socket
    ... Be aware that those port numbers are part of the IANA-assigned range. ... socket operations on sockets for which there are no handles... ... The result of using comma lists is ... you have used the completely meaningless word "crash" to describe your ...
    (microsoft.public.vc.mfc)
  • RE: call is blocked in recvfrom() and no further proceedings in Win CE
    ... In windows CE, I'm able to send a request but I'm unable to receive it. ... Create another socket & bind with server IP address. ... > My program has to send request to service through port 5070(in this port only ...
    (microsoft.public.windowsce.embedded)