View Single Post
Old 06-13-2012, 04:41 PM   PM User | #9
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,751
Thanks: 4
Thanked 2,468 Times in 2,437 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Just use the example. All you need is to open the socket, then issue an .accept() within the while(true). Maybe sleep it for a couple of seconds. That's all you got to do. Technically you don't even need to accept if you don't plan on doing anything with it:
PHP Code:
    public static void main(String[] argvthrows IOExceptionInterruptedException
    
{
        
ServerSocket welcomeSocket = new ServerSocket(43594);
        while (
true)
        {
            
Thread.sleep(2000);
            
System.out.println("Nothing to do; take'n a nap.");
        }
    } 
That's it.
Fou-Lu is offline   Reply With Quote