wood burning stoves 2.0*
The moose likes Other Java Products and Servers and the fly likes ServerSocket problem w/ Jeode EVM on iPaq Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "ServerSocket problem w/ Jeode EVM on iPaq" Watch "ServerSocket problem w/ Jeode EVM on iPaq" New topic
Author

ServerSocket problem w/ Jeode EVM on iPaq

Ankur Shah
Greenhorn

Joined: Nov 09, 2001
Posts: 10
Javaranch
I am having a socket problem with Jeode on iPaq. I have a client program and a server program which I have running on the same iPaq machine. All the server side does is start a ServerSocket and listens for a Socket from the client side. The client side just makes a Socket object to the same ip/port.
When I initially run the program the socket is successfully accepted on the server side. However when I close the client and server programs and rerun them multiple times I eventually (2nd - 4th try) get an error on the client side saying:
java.net.ConnectException
I am cutting and pasting the client and server side below.
I think it has something to do with the ServerSocket but I'm not sure. I would greatly appreciate help on this problem.
Thanks
Ankur Shah

CLIENT SIDE---------------------------------------
import java.io.*;
import java.net.*;

public class clientTest
{

public static void main (String[] args)
{
System.out.println("Client Started...");
Socket sock = null;
try
{
sock = new Socket("127.0.0.127",500);
System.out.println("Socket Created Successfully);
}
catch(IOException e)
{
System.out.println(e);
}
try
{
while(true)
{
Thread.sleep(500);
}
}
catch (InterruptedException e){}
}
}

SERVER SIDE---------------------------------------
import java.io.*;
import java.net.*;
public class serverTest
{
public static void main (String args[])
{
System.out.println("Server Started...");
ServerSocket ss = null;
try
{
InetAddress inet = InetAddress.getByName("127.0.0.127");
ss = new ServerSocket(500,20,inet);
System.out.println("ServerSocket listening on:\n"+ss.getInetAddress()+"/"+ss.getLocalPort());
ss.accept();
System.out.println("Socket Accepted");
}
catch(IOException e)
{
System.out.println(e);
}
catch(Exception e)
{
System.out.println(e);
}

try
{
while(true)
{
Thread.sleep(500);
}
}
catch (InterruptedException e){}
}
}
 
jQuery in Action, 2nd edition
 
subject: ServerSocket problem w/ Jeode EVM on iPaq
 
Similar Threads
Sending a message to multiple clients with one call
plz help me (Socket problem)
Read/Writer Thread problem in Socket
full duplex chatty in Java (CODE PASTED)
problems with my server