Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Java network programming help

Status
Not open for further replies.

KZWings

IS-IT--Management
Jan 30, 2003
2
US
I have my two programs here:


This is going to be simple for most of you, but i need to modify the client to allow the user to specify an IP address. I need to provide secure communications between the client and the server as well. A simple encryption and decryption method MAY have to be done. ANY HELP IS MUCH APPRECIATED, thanks!! :)
 
So instead of using the hard coded IP string "127.0.0.1" you take the String from the array of command line arguments passed into the main() method and pass it into the constructor of your class.

Code:
 // execute application
public static void main( String args[] )
{
   final Client2 application = new Client2( args[0]);

   application.runClient();
}

Then from there of course you need a member variable to store the String in the instance so you can use it later place of the hard coded string. Also just pass the String to the Socket constructor.

Code:
Socket( _strConnect, 5558);

-pete


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top