Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to start in socket programming

 
samrat sri harsha kavuri
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

I am completely new to java. In my college i have got a chance to work in a project involving socket programming. my current status is

1) i am moderately good in C.
2) i have 2 weeks of time to learn java starting from jan 24th.

my question is
1) can anyone suggest any strategy of how go about it?
2) any nice urls/sites or books if u can suggest so that i can learn
java first would be great.
3) any other suggestions or advice would be of great help to me.

thanks in advance,
harsha.
 
Catalin Merfu
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://java.sun.com/docs/books/tutorial/networking/
 
Alexander Rudloff
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
get on the web and research the syntax differences that do exist between c and java, read as much as you can on OO, and go through the tutorials on suns website.

best of luck.
 
Paul Santa Maria
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Networking tutorial mentioned above is an excellent suggestion.

I'd also highly recommend:

Java Network Programming, 3rd Edition
Elliotte Rusty Harold; O'Reilly, 2005
ISBN 0-596-00721-3

It's an great introduction; it's an equally great in-depth reference book. Satisfaction guaranteed!
 
David Harkness
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing that will make a big difference in how difficult a task you have is whether you need to create a client or server with regards to sockets. In other words, are you writing an application that will accept connections from many client applications (like a web server), or will your application be the client, talking to one server at a time (for the most part)?

Of course, if you're creating your own protocol (the "language" that the client and server use over the socket to speak to each other) you'll be writing both client and server.

As well, Java now has two methods for programming sockets: input/output streams (the old way) and channels (known as New I/O or NIO). NIO was introduced in JDK 1.4 and may not be available to you if your requirements limit you to a pre-1.4 JDK. I mention this not to confuse you but rather because the NIO classes and methods (functions) are far easier to use than streams.

Here are two more links for you. Master Merlin's new I/O classes, a JavaWorld article, introduces the NIO classes but starts with a very brief overview of the old stream usage. I found this DeveloperWorks tutorial to be pretty complete. The tutorial seemed like it would be good for beginners as it covered each piece while building a sample client-server application. Oh, the tutorial is free; you just have to register an account (also free).

Finally, if you can, you may want to post up a brief description of what you'll be working on and see what advice the ranchers have for areas on which to focus your studies.

Of course, ask questions as they arise. That's why we hang out here.

Good luck!
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic