0

i have used socket name space to establish connection between two system, now i am able to send and receive message , now i want to get information about packet that has been received , like header information( sender Address , ttl and ... )

int sendCount = 1;// Number of times to send the response
int bufferSize = 4096;// Size of the send and receive buffers
IPAddress localAddress = IPAddress.Any;
SocketType sockType;
ProtocolType sockProtocol;
int rc;
Socket clientSocket;
byte[] receiveBuffer, sendBuffer;
Socket serverSocket = null;
Moslem7026
  • 3,290
  • 6
  • 40
  • 51

1 Answers1

0

You don't receive packets with TCP, you receive byte streams.

You can get the sender's remote address and remote port from the accepted socket, once you have it.

You can't get the TTL of a packet at all without going to a much lower layer where you don't wanna go, believe me.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • is it possible to include header information of socket object with `Sock.SetSocketOption(SocketOptionName.IP, SocketOptionLevel.HeaderIncluded, 1)` and then read header information ? – Moslem7026 Sep 12 '12 at 08:12
  • @Moslem7026 I don't know. What did you make of the documentation? – user207421 Sep 12 '12 at 08:56
  • i searched and find that i should use raw socket to send custom header and recieve header information , can u help me ? – Moslem7026 Sep 12 '12 at 09:01