TCP protocol in Java  
Author Message
Bala Shanmuga Priyan





PostPosted: 2007-3-7 1:23:00 Top

java-programmer, TCP protocol in Java Hi all,
I would like to know is it possible to implement a transport
layer protocol such as TCP in java. Although its available in java.net
package, i like to create my own. Also is there any detailed
explanation for source code of java.net package.

Thanks in advance

 
Christian





PostPosted: 2007-3-7 2:07:00 Top

java-programmer >> TCP protocol in Java
Bala Shanmuga Priyan schrieb:
> Hi all,
> I would like to know is it possible to implement a transport
> layer protocol such as TCP in java. Although its available in java.net
> package, i like to create my own.

You can implement your own transport protocol by utilizing UDP .. UDP
gives you basically the Network layer and has nearly no data on
Transportlayer. Forming your own packets directly may not be allowed
based on what OS and what userrights you have, so there is no
implementation in java.

> Also is there any detailed
> explanation for source code of java.net package.
>
> Thanks in advance
>
 
Chris Uppal





PostPosted: 2007-3-7 2:47:00 Top

java-programmer >> TCP protocol in Java Bala Shanmuga Priyan wrote:

> I would like to know is it possible to implement a transport
> layer protocol such as TCP in java. Although its available in java.net
> package, i like to create my own. Also is there any detailed
> explanation for source code of java.net package.

If you don't want to layer over UDP (as Christian has already suggested) then
you should be able to do it using a Java wrapper for the pcap library (pcaplib
or WinPcap).

I don't know whether pcap has Java wrappings available yet for sending packets
yet. I not then you'd have to write your own -- but in comparison to
designing, implementing, and testing, a transport-layer protocol, that should
be a doddle ;-)

-- chris



 
 
Arne Vajh鴍





PostPosted: 2007-3-12 11:13:00 Top

java-programmer >> TCP protocol in Java Bala Shanmuga Priyan wrote:
> I would like to know is it possible to implement a transport
> layer protocol such as TCP in java. Although its available in java.net
> package, i like to create my own. Also is there any detailed
> explanation for source code of java.net package.

Java does not support raw sockets so you would need
to do something in C++ and use JNI.

Maybe look at http://www.savarese.org/software/rocksaw/ !

If it is for a real world problem: forget it and
focus on the higher level problems.

Arne