TCP protocol in Java

Discussion in 'Java' started by Bala Shanmuga Priyan, Mar 6, 2007.

  1. 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
    Bala Shanmuga Priyan, Mar 6, 2007
    #1
    1. Advertising

  2. Bala Shanmuga Priyan

    Christian Guest

    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
    >
    Christian, Mar 6, 2007
    #2
    1. Advertising

  3. Bala Shanmuga Priyan

    Chris Uppal Guest

    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
    Chris Uppal, Mar 6, 2007
    #3
  4. 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
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Mar 12, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeffrey Spoon

    Custom Protocol over TCP

    Jeffrey Spoon, Dec 31, 2004, in forum: Java
    Replies:
    6
    Views:
    1,080
    Jeffrey Spoon
    Jan 1, 2005
  2. Mark
    Replies:
    1
    Views:
    2,699
    john farrow
    Aug 29, 2004
  3. K2
    Replies:
    3
    Views:
    405
    dimitar
    May 18, 2006
  4. Replies:
    5
    Views:
    1,704
    Chris Uppal
    Jan 16, 2007
  5. Replies:
    0
    Views:
    338
Loading...

Share This Page