This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Sockets and Internet Protocols and the fly likes how to give port number for socket class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "how to give port number for socket class" Watch "how to give port number for socket class" New topic
Author

how to give port number for socket class

vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
how to give port number in socket class?

Socket sc=new Socket(hostname,portnumber);

can anybody tell about hostname,portnumber
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8915
    
    8

If you look at the JavaDoc for Socket, it says:
public Socket(String host, int port)


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
vijayakumar durai
Ranch Hand

Joined: Aug 18, 2008
Posts: 153
this tutorial not explain how to give port number i gave port number 1748 it give error
java.net.connectionexception connection refuse can any body tell how to give port number?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8915
    
    8

"java.net.connectionexception connection refuse" indicates that either there is no service listening to the port you have specified or that the port is blocked. You are passing the port number correctly, there's nothing for it to connect to.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to give port number for socket class