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
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
Forum:
Sockets and Internet Protocols
what is the prob !!!
maruf rahman
Greenhorn
Posts: 4
posted 14 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 14 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: 22783
131
I like...
posted 14 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
Consider Paul's
rocket mass heater
.
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...