Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Sockets and Internet Protocols
Search Coderanch
Advance search
Google search
Register / Login
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
Tim Cooke
paul wheaton
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
Sockets and Internet Protocols
what is the prob !!!
maruf rahman
Greenhorn
Posts: 4
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hello....this code is form
webpage
does not run in my mechine.....whats the prob ??
here "phoenix" is my mechines name
import java.io.*; import java.net.*; public class EchoClient { public static void main(String[] args) throws IOException { Socket echoSocket = null; PrintWriter out = null; BufferedReader in = null; try { echoSocket = new Socket("phoenix", 7); out = new PrintWriter(echoSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader( echoSocket.getInputStream())); } catch (UnknownHostException e) { System.err.println("Don't know about host: phoenix."); System.exit(1); } catch (IOException e) { System.err.println("Couldn't get I/O for " + "the connection to: phoenix."); System.exit(1); } BufferedReader stdIn = new BufferedReader( new InputStreamReader(System.in)); String userInput; while ((userInput = stdIn.readLine()) != null) { out.println(userInput); System.out.println("echo: " + in.readLine()); } out.close(); in.close(); stdIn.close(); echoSocket.close(); } }
Ulf Dittmer
Rancher
Posts: 43081
77
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Welcome to JavaRanch.
What does "does not run" mean? Does the machine go up in flames? If not, are there any error messages?
Rob Spoor
Sheriff
Posts: 22821
132
I like...
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
In other words:
tell the details
. Also provide the stack trace if you get one.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions
How To Answer Questions
Our first order of business must be this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to run Client socket?
not able to connect...
two server and many client....
Guys, need help on tcp socket (Urgent)
I am getting java.net.UnknownHostException
More...