Results 1 to 7 of 7
  1. #1
    twoHats is offline Member
    Join Date
    Apr 2009
    Posts
    4
    Rep Power
    0

    Default port already in use...

    Hello all - This is my first post.

    1. I tried to search this forum (i really did) but kept running into search term not long enough (4 words) even when my search was "port already in use exception", clearly longer than 4 words. Sooo, apologies if this topic already exists.

    I am trying to write a small program to intercept data packets from an external server to a client on my computer (this is a windows client). This is nothing nefarious, but would be useful, and will be released as OS freeware.

    Problem is that the only way to get the port number is to start the client - but then the port is in use and cannot be attached to without an exception being thrown. I am trying to use a proxy server setup here, but am not married to it. I am also a networking nubi, but fluent in Java.

    Any and all ideas appreciated, and i will gladly get more detailed if need be.

    Thankful for any response

  2. #2
    twoHats is offline Member
    Join Date
    Apr 2009
    Posts
    4
    Rep Power
    0

    Default Really?

    Is there really no one who can answer this question? Did i make a faux pas in the wording? Is it just a stupid question?

    Network analyzers like wireshark do this all the time, therefor it is possible.

    I just want to capture data coming in on a port for analysis, without disrupting the dataflow. Is it really that difficult?

    Thanks to any responders.

  3. #3
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    In order to do that you need to interface with much lower-level code than Java will allow (i.e. down in the OS transport layer).
    You could set up a proxy in Java, listening or transmitting on a different port, but you would have to configure your other applications to use that port.
    Last edited by OrangeDog; 04-27-2009 at 10:42 PM.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  4. #4
    twoHats is offline Member
    Join Date
    Apr 2009
    Posts
    4
    Rep Power
    0

    Default Thanks Orange Dog!

    Thank you - I am also conversant in C, can you steer me in the right direction?

    Thanks again!

  5. #5
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    In order to packet sniff invisibly you need to hook into the OS's network stack. On Windows the various components are running as part of one or more Services. I imagine there'll be lots of security business to contend with too. Best of luck.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  6. #6
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    try to use JPCAP.
    freedom exists in the world of ideas

  7. #7
    twoHats is offline Member
    Join Date
    Apr 2009
    Posts
    4
    Rep Power
    0

    Default Thanks!

    Thank you for the reply! I will check out jpcap...

    Just had a look - this is exactly what i was seeking - Thanks!
    Last edited by twoHats; 05-04-2009 at 07:14 AM.

Similar Threads

  1. how to write to parallel port?
    By gen1mx6 in forum NetBeans
    Replies: 3
    Last Post: 07-30-2010, 06:06 PM
  2. Serial Port
    By radhika in forum New To Java
    Replies: 5
    Last Post: 11-06-2009, 10:40 AM
  3. Serial Port Ethernet
    By nipunreddevil in forum Networking
    Replies: 2
    Last Post: 03-01-2009, 05:22 PM
  4. rs232 serial port on xp
    By simo_mon in forum New To Java
    Replies: 0
    Last Post: 12-04-2008, 11:25 AM
  5. serial port
    By musiigedeo in forum Advanced Java
    Replies: 0
    Last Post: 07-23-2007, 04:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •