Connecting to server

Hello, so I have not used Java in over four years. Actually done very little programming or computers in that time period. Anyways, I was going through some of my old code and I am having a very newbie issue with one of my programs.

It is a Socket code that creates a server which listens for a connection for 1 minute and then expires.

Thats great fine dandy.. compiles - i understand it because I have great comments. However, I never created a README file on steps I have to take to connect to the server.

Basically, I remember that I used to go to File->Run and typing in something (I am guessing it involves servers IP Adress and port #) to connect to the server. BUT, I dont remember how to do that anymore. Ya, I feel stupid but it has been so long since I played with computers. Was wondering if someone can help me figure out?

In summary,

My code creates a server that is waiting for a connections from others

But I dont know how to connect to it anymore!

This is the snippet that creates the server:

try {

myServer = new ServerSocket(portNumber);

myServer.setSoTimeout(30000);//server times out after 30 seconds

}

catch (IOException e) {

System.out.println("Got exception trying to create serversocket: " + e);

}

I tried using

1) "telnet ip port"

2) "telnet ip:port"

but to no avail.

Message was edited by:

StreetFighter

Message was edited by:

StreetFighter

[1517 byte] By [StreetFightera] at [2007-10-2 21:22:47]
# 1

You can make a client program yourself. Create a socket for that server and port and read and write from it. It shouldn't take more than 10 lines of code.

You can also use an already existing client. You mentioned using a client program on your computer. If your server is a telnet server, you can use your OS's built-in telnet program. You can create a connection with a telnet server anyways, although your server may drop you due to a timeout if telnet is not the protocol.

You said your server listens for a connection for one minute and then expires. That sounds like a socket timeout. You have it running in a loop, right?

ktm5124a at 2007-7-14 0:33:14 > top of Java-index,Java Essentials,Java Programming...
# 2
Ok, I figured it out. I was being lazy and used whatismyipaddress.com to see my ip address. However, that was incorrect. I used ipconfig and it gave me correct IP address.lolIt works!Message was edited by: StreetFighter
StreetFightera at 2007-7-14 0:33:14 > top of Java-index,Java Essentials,Java Programming...