How to close a socket which is already open
-
hi My aim is to close a socket which is already open Socket.close() is raising exception i have tried with few other things still its not closing properly So if any one knows how to do this then plz do let me know regards sindhu tiwari
its me sid
-
hi My aim is to close a socket which is already open Socket.close() is raising exception i have tried with few other things still its not closing properly So if any one knows how to do this then plz do let me know regards sindhu tiwari
its me sid
Are you calling the
ShutDown()
method before you make a call toClose()
?All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
Are you calling the
ShutDown()
method before you make a call toClose()
?All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
thanks for replying ......................will u plz tell me what this ShutDown() does I would like to brief my problem .. I am having a mobile application ......so if the mobile switches off i need to close the socket at my end ........ can u tell me the best way to do this .....apart from pinging it continously
its me sid
-
thanks for replying ......................will u plz tell me what this ShutDown() does I would like to brief my problem .. I am having a mobile application ......so if the mobile switches off i need to close the socket at my end ........ can u tell me the best way to do this .....apart from pinging it continously
its me sid
sindhutiwari wrote:
will u plz tell me what this ShutDown() does
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
hi My aim is to close a socket which is already open Socket.close() is raising exception i have tried with few other things still its not closing properly So if any one knows how to do this then plz do let me know regards sindhu tiwari
its me sid
-
Hi Sid, Dear I am also working on socket application. Try this statement "objSock.Shutdown(SocketShutdown.Both);"
hi Akmal Dear,Thanks for ur reply .....i have tried that too ..it dint work perfectly...with my application as u r also working on socket application will u plz tell me how you are determining the status of client i mean to say connected or disconnected ......u r following two way pinging or any other thing plz do let me know
its me sid
-
hi Akmal Dear,Thanks for ur reply .....i have tried that too ..it dint work perfectly...with my application as u r also working on socket application will u plz tell me how you are determining the status of client i mean to say connected or disconnected ......u r following two way pinging or any other thing plz do let me know
its me sid
Dear Sid, I am using this piece of code in thread.It tells me when client is connected and send data to me. Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, 8001); listener.Bind(endpoint); listener.Blocking = true; listener.Listen(0); Socket objSock = listener.Accept(); objSock.Receive(ReceiveData); objSock.Shutdown(SocketShutdown.Both); listener.Close();
S.Akmal
-
hi Akmal Dear,Thanks for ur reply .....i have tried that too ..it dint work perfectly...with my application as u r also working on socket application will u plz tell me how you are determining the status of client i mean to say connected or disconnected ......u r following two way pinging or any other thing plz do let me know
its me sid
-
dear Sid. did u try the socket.connected property. It returns a boolean value either u r connected or disconnected.
Mr.Syed
I want to close the Client Socket ....Not the Listner(Server) how u r handeling Client Socket and Socket.Connected returns the previous state
its me sid
-
I want to close the Client Socket ....Not the Listner(Server) how u r handeling Client Socket and Socket.Connected returns the previous state
its me sid