R
Rolln_Thndr
I'm vey new to network programing and have a few rather fundemental questions.
I'm creating a very basic UDP proxy server and having a few issues regarding the sockets. Is it possible to change the properties of a socket WITHOUT closing it and creating a new one?
Basically, I need to change the port of a bound socket, but the only way I have found to do this so far is to close the exisitng socket and create a new one. This in itself isn't hard to do but my app is threaded and I run into complications when a one thread is blocking on the socket's ReceiveFrom method. I have to kill the thread, close the socket, change the local endpoint port property, recreate the socket, bind it and then start a new thread which then awaits the incoming datagrams again.
Maybe I'm missing something and this may be the only way to do it, but it seems really complex. Not too mention I'm not sure what the implications will be when I stop and start one of the 'listening' threads, I don't want to miss any datagrams that are sent to the proxy while I'm changing the local endpoint the socket is bound to.
Any advice would be great. I've done a lot of looking around and haven't found any info that deals with 'changing' socket properties once a socket has been created. I've also purchased "C# Network Programming" by Richard Blum, which is a great book but I haven't found anything about this in their either.
Thanks.
I'm creating a very basic UDP proxy server and having a few issues regarding the sockets. Is it possible to change the properties of a socket WITHOUT closing it and creating a new one?
Basically, I need to change the port of a bound socket, but the only way I have found to do this so far is to close the exisitng socket and create a new one. This in itself isn't hard to do but my app is threaded and I run into complications when a one thread is blocking on the socket's ReceiveFrom method. I have to kill the thread, close the socket, change the local endpoint port property, recreate the socket, bind it and then start a new thread which then awaits the incoming datagrams again.
Maybe I'm missing something and this may be the only way to do it, but it seems really complex. Not too mention I'm not sure what the implications will be when I stop and start one of the 'listening' threads, I don't want to miss any datagrams that are sent to the proxy while I'm changing the local endpoint the socket is bound to.
Any advice would be great. I've done a lot of looking around and haven't found any info that deals with 'changing' socket properties once a socket has been created. I've also purchased "C# Network Programming" by Richard Blum, which is a great book but I haven't found anything about this in their either.
Thanks.