IntelliJ Java IDE
The moose likes Sockets and Internet Protocols and the fly likes How can you test a server program Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "How can you test a server program" Watch "How can you test a server program" New topic
Author

How can you test a server program

Jeff Slominsky
Greenhorn

Joined: Dec 10, 2001
Posts: 12
I wrote a small chat server and attempted to telnet using
localhost as the server name, but the connection kept failing. When I pinged my computer(localhost), it worked, can anybody tell me how to telnet into my own ports, say from 2000 and above??
thank you,
Jeff
Joel Peach
Greenhorn

Joined: Oct 12, 2001
Posts: 19
Jeff,
The way the telnet command works is platform specific but something that usually works is:
> telnet localhost port
Where port is the numeric value of the port you're trying to reach. Sometimes, an alternate URI-like syntax is used like the following:
> telnet localhost:port
This is almost identical except the colon is used as a delimiter between the hostname and the port.
If these don't work, let me know which platform and telnet software you're using and I'll see if we can't pinpoint the issue.
As a note, localhost is an internet alias that always points to the loopback IP address: 127.0.01 It's basically the IP standard way of saying the destination is "the host that originated the request." Although it shouldn't make a difference, you could always try substituting the numeric IP equivalent of 127.0.0.1 for localhost.
Best of luck!
-Joel
jpeach@traceris.com
David Weitzman
Ranch Hand

Joined: Jul 27, 2001
Posts: 1365
If you can write a chat server, you should be able implement a basic sort of telnet yourself in just a few lines of java. I once wrote a bit of a chat server and found my two programs for making myself a client or a server indispensable.
 
 
subject: How can you test a server program
 
Threads others viewed
how to send email using Java Program?
Access telnet server via browser
tomcat - mysql : Connection refused
Problem wid javamail.address.map
java.net.ConnectException: Connection refused:
MyEclipse, The Clear Choice