• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ServerSocket problem w/ Jeode EVM on iPaq

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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){}
}
}
 
reply
    Bookmark Topic Watch Topic
  • New Topic