Results 1 to 3 of 3
Thread: Creating Socket Issue
- 08-22-2009, 08:47 AM #1
Member
- Join Date
- Aug 2009
- Posts
- 26
- Rep Power
- 0
Creating Socket Issue
hey, i'm pretty new at this networking stuff in java and i was wondering
if someone could tell me how to do this.
My command line arguments for the client in this java program i'm writing contain the server ipAddress which is args[2] and the port number args[3]
But i'm not sure how to convert the server "IpAdress" args[2] into an InetAddress so i can create the socket.
This is my failed attempt, might give you a better idea of what i'm trying to do.
Thanks,Java Code:clientSocket = new Socket((InetAddress)args[2], Integer.parseInt(args[3]));
- 08-25-2009, 10:20 AM #2
Member
- Join Date
- Aug 2009
- Posts
- 49
- Rep Power
- 0
Hi Castiel,
The args[] is not similar to c++. In java the first argument is counted as args[0] and the second argument is counted as args[1]. Try to print this using System.out.println(args[0]) before considering it for ipaddress.
cordially
Anand Ravindran
for online java tutorial visit :: Java Needs - Java Programmers' Website ::
for project dreams visit Webarch Technologies
- 08-25-2009, 01:34 PM #3
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Similar Threads
-
issue after creating plug-in
By james_nevil in forum EclipseReplies: 0Last Post: 08-19-2009, 11:32 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 -
help about Socket
By fahien_akim in forum New To JavaReplies: 0Last Post: 04-16-2009, 10:41 AM -
writting extended ascii chars on socket........or Endianness Issue......??
By sachinj13 in forum Threads and SynchronizationReplies: 8Last Post: 09-23-2008, 02:20 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