• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

socket programming

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic