A Networking Question

Jul 17, 2010 at 2:55 PM

Hi Boaz,

  This is really a general network question but I think you might be able to answer it :)

  Pcap.Net allows me to sniff packets at the ethernet level.  So.. does an ethernet level packet that encaspulates a TCP/IP packet contain information as to whether connection was successful?  I plan to test it as follows in C#:

  1. With Pcap.Net sniffing
  2. Create a TCP/IP Stream Socket.
  3. Socket.Connect() to a non listening port.

  My C# program will throw the error, unable to connect etc - BUT Boaz can I find out that the Socket.Connect failed by studying the ethernet packets?  If so - what do I look for?  How does Ethernet layer establish a connection?


Jul 17, 2010 at 3:01 PM

There is no such thing as an Ethernet connection.

You're creating a TCP/IP connection over the network by using your Ethernet LAN to send packets.

You should look at the TCP layer to see what happened to the connection.

There are different ways for a connection to fail - no response (timeout), reset (RST flag) and more.

You should probably read about the basics of TCP if you want to understand this further.