On Wed, Apr 8, 2009 at 9:00 PM, Ponnapalli Hari Gopal <[email protected]> wrote: > > Hi, > I am bit new to the network programming. I am developing a server based on > Mina using datagram sockets. I am bit confused with the datagram sockets > here. When I start an instance of the server on a port (say 1812) it starts. > However, when I run a second instance of the server on same port, it also > binds to that port successfully. I am expecting that the bind should fail > here as the port is already in use, the TCP/IP way. Is it an expected > behavior of UDP datagrams? > > If this is the expected behavior, how do I know which instance of the server > receives the packets?
See this http://www.softlab.ntua.gr/facilities/documentation/unix/unix-socket-faq/unix-socket-faq-2.html#time_wait This is TCP stack behaviour. You may want to set reuseaddress to false > > Basically, I am trying to develop a RADIUS server on top of Mina. The server > is up and running. However, if there are multiple instances of the server > running, sometimes I am facing strange behavior in terms of none of the > servers are receiving the packets. All of them should run on different ports or on different machines, else you have to develop a protocol above TCP for demultiplexing > > Can someone provide any pointers on how to developa datagram server reliably. > I also want to provide some start, shutdown scripts that allows the users to > start, stop the server. For this, any guidance on what is the approach to be Can plan to use JMX or simple shell scripts will do. followed. If I start the server in a new thread, and close the main program, the server thread also (being child) is getting closed. So, do I need to start a separate port on which server listens for administrative commands like start, shutdown? If your close the main program means exits the JVM, no Java program can run. You should think of running the program as background process In such case how to provide authentication of it? Or shall I need to use some shared memory (flag) that will be used by both server and startup/shutdown scripts. In such case the server requires constant polling of the shared variable to start/stop the server. > > Also does the RADIUS need to be mandatarily supported only on UDP? RFC's are better place to look for this. > > Sorry for my stupid questions, but, any ideas/guidance on same is highly > appreciated. > > Regards, > Hari > > > > -- thanks ashish Blog: http://www.ashishpaliwal.com/blog My Photo Galleries: http://www.pbase.com/ashishpaliwal
