CrazyEngineers Forum

******************************************
Welcome To CrazyEngineers (CE) – an online community of engineers from all over the world! With the younger CEan at 84 and the youngest at 16, CE boasts of professional engineers, students, professors, entrepreneurs, CEOs, geeks & nerds. We exchange innovative ideas, share knowledge, help each other and expand our worldwide network of engineers! You need not have a formal degree in engineering to be a part of CrazyEngineers! Need we say more?
Join CE! | Be a CE Ambassador! | Forgot password? | Sponsor CE | Contact Us
Navigation
Go Back   CrazyEngineers Forum > CE : Technical Discussions > Computer Science & IT Engineering
Reply

  #1 (permalink)
Old 13th August 2008, 02:27 AM
CE - Newbie
 
umesh936's Avatar
 
I'm a Crazy Computer Science Engineer
Join Date: 26th November 2006
Posts: 9
Default Question on java Socket

Hi all
My question is: if i make a socket connection between two computers,offcoure one is server socket and other is simple socket, then when i use printstream for that socket to write on it like
PrintStream p= new PrintStream(so.getOutputStream());
now i write like p.println(); here i am writing on port...and other port of client side listening to it, then in this whole work ,IS TCP/IP comes in picture?
if yes then i don't want that TCP/IP initiate itself , i want to make my own protocol for two computer to talk then how to start , guide me....?keep in mind that i am only using socket...
umesh936 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
  #2 (permalink)
Old 23rd August 2008, 03:29 PM
CE - Apprentice
 
vijayrock's Avatar
 
I'm a Crazy Computer Engineer
Join Date: 19th July 2008
Location: Chennai
Posts: 16
Default Re: Question on java Socket

socket and serversocket are two classes that are meant for TCP/IP implementation in JAVA.

In the client side...
1.a new socket is created
2.socket attempts to connect to the remote host
3.Once the connection is established,the local and remote hosts get I/P and O/P streams and uses them for sending data to each other.
4.once the transmission is complete,one or both the sides closes the connection

In the server side
1.a new serversocket is created on a port
2.serversocket listens to the particular port for any incoming connection using the accept().accept() blocks until a client attempts to connect.when the client tries to connect,accept() returns a socket object connecting the client and the server
3.server and the client interact according to an agreed upon protocol until the close() is called
4.both closes the connection.
5.then the server gets back to the step 2(above).


TCP/IP is the internationally agreed protocol for connection oriented data transfer.
u can well propose any concept.It becomes a protocol only when its accepted as a standard that is to be followed.study about TCP/IP and UDP much more so that u might get more ideas about them(like u would get to know the problems involved in them).
__________________
Vijayaragavan V
Searching for destiny!
My Blog!
vijayrock is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)
Old 24th August 2008, 02:35 PM
CE - Apprentice
 
I'm a Crazy Computer Engineer
Join Date: 24th July 2008
Posts: 46
Default Re: Question on java Socket

There are two kind of protocol ... TCP and UDP if any case you have 2 use these ....
niraj.kumar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored links
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +5.5. The time now is 05:07 PM.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Member comments are owned by the poster. Copyright © 2005-2008 CrazyEngineers.com. All rights reserved.Ad Management by RedTyger