-
connection problem on port 13 for daytime
I'd like to print the daytime from localhost on port 13
import java.io.*;
import java.net.*;
class a
{
public static void main(String[] args) throws IOException
{
Socket localDateSocket = new Socket("localhost", 13);
BufferedReader reponse = new BufferedReader(new InputStreamReader(localDateSocket.getInputStream()));
String date = reponse.readLine();
System.out.println("Date : " + date);
reponse.close();
localDateSocket.close();
}
}
But the result I got is :
Exception in thread "main" java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.<init>(Socket.java:309)
at java.net.Socket.<init>(Socket.java:124)
at a.main(a.java:8)
I'm on a local network that enables me to go on the net through a proxy (proxy.ec-lyon.fr:3128) that imposes me lots of restrictions. Is this there where the problem is ?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks