i am using the net.socket class for some tcp traffic.
it works fine but i have a problem to shutt it down!
......
when i start the server :
server.Bind(localEP)
server.Listen(1)
clientSocket = server.Accept() waiting first here
do while true
countBytesFromClient = clientSocket.Receive(bytes) waiting here
.....
loop
the thread will hang on server.accept line. ok no problem.
i put that in a sub and started it as a secondary thread.
so the the form with all the buttons will work while the tcp server is watching for a client.
when the client is connected and sending the first data it returns to the clientsocket.reive(bytes) - line to wait for the next package.
no problem again.
when the client shutts down the clientsocket will become "nothing"- i can catch this exception an shutt the server down.
but when i want to shutt down my server first i get in trouble!
i tried:
runningThread.Abort() and catch the ThreadAbortException
but it is not working.
the thread still stays at clientSocket.Receive(bytes)....
when i send another package to the socket, then it will throw the
ThreadAbortException ...
pleazzzzz is there a way to make the thread go on?
it works fine but i have a problem to shutt it down!
......
when i start the server :
server.Bind(localEP)
server.Listen(1)
clientSocket = server.Accept() waiting first here
do while true
countBytesFromClient = clientSocket.Receive(bytes) waiting here
.....
loop
the thread will hang on server.accept line. ok no problem.
i put that in a sub and started it as a secondary thread.
so the the form with all the buttons will work while the tcp server is watching for a client.
when the client is connected and sending the first data it returns to the clientsocket.reive(bytes) - line to wait for the next package.
no problem again.
when the client shutts down the clientsocket will become "nothing"- i can catch this exception an shutt the server down.
but when i want to shutt down my server first i get in trouble!
i tried:
runningThread.Abort() and catch the ThreadAbortException
but it is not working.
the thread still stays at clientSocket.Receive(bytes)....
when i send another package to the socket, then it will throw the
ThreadAbortException ...
pleazzzzz is there a way to make the thread go on?