This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills: The software developer's life manual and have John Sonmez on-line!
See this thread for details.
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

socket programming

 
muthoju haritha
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to Sort the integers from a client process into ascending order and then send
the sorted numbers back to the client through a message queue.
 
Joe Ess
Bartender
Posts: 9214
9
Linux Mac OS X Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, muthoju. We love to talk all things Java here but we get our fair share of people asking us to do their homework for them. We ask that you at least make an effort at writing some code and ask some specific questions. Try starting with sending and receiving information. The Java Tutorial on Custom Networking is a good place to start with sockets.
 
muthoju haritha
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
while establishing connection with server,getting the localhost address i did
try {
InetAddress here = InetAddress.getLocalHost ();
hostname = here.getHostName ();
logDisplay.append ( "host = "+hostname+"\n" );
}
catch (UnknownHostException e) { ;}
is this the coorect approach
 
Layne Lund
Ranch Hand
Posts: 3061
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by muthoju haritha:
while establishing connection with server,getting the localhost address i did
try {
InetAddress here = InetAddress.getLocalHost ();
hostname = here.getHostName ();
logDisplay.append ( "host = "+hostname+"\n" );
}
catch (UnknownHostException e) { ;}
is this the coorect approach


This is a start since it means you are looking at some of the methods available in the Java API. Now you need to figure out how to create the client and server processess. The client process will somehow obtain a list of numbers to send to the server. The server will accept the client's connection, recieve the numbers, sort them, and send them back.

Notice how I have briefly describe the tasks involved. This is typically a good place to start with any computer program, even non-networked ones. Now you will need to find the right APIs that will allow you to carry out each task.

Layne
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic