Results 1 to 1 of 1
Thread: Socket question
- 03-10-2010, 03:12 AM #1
Member
- Join Date
- Jan 2010
- Posts
- 81
- Rep Power
- 0
Socket question
I have 2 computers on a local network with a router. I installed NetBeans and JDK on both computers and successfully ran the Client/Server KnockKnock tutorial, which uses the socket class.
My client (MyCPU) uses the following line to create a new Socket object to connect to the server (Kim-PC):
I want to try to get it working across the internet now instead of just on my local network.Java Code:kkSocket = new Socket("KIM-PC", 62571);
Since both computers share the same IP Address, can I use the Socket class as follows?
which would translate on my system to...Java Code:Socket(String host, int port, InetAddress localAddr, int localPort)
*where xxx.xxx.xxx.xxx = my IP addressJava Code:Socket("KIM-PC", 62571, xxx.xxx.xxx.xxx, int localPort)
If so, what is the localPort?
Similar Threads
-
Question mark colon operator question
By orchid in forum Advanced JavaReplies: 9Last Post: 12-19-2010, 08:49 AM -
append response to the request from Socket and write to another socket
By vaibhav_singh_vs@yahoo.co in forum NetworkingReplies: 3Last Post: 04-17-2009, 07:02 PM -
Socket
By rob in forum New To JavaReplies: 1Last Post: 03-19-2009, 02:24 PM -
Programming Socket Question
By paul in forum NetworkingReplies: 1Last Post: 07-30-2007, 07:26 PM -
XML through a socket
By Heather in forum XMLReplies: 2Last Post: 07-04-2007, 09:31 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks