C# Raw Socket Issues starting TCP Connections
From: banduraj (banduraj_at_dtmf.org)
Date: 03/17/05
- Next message: Amiram Korach: "RE: How to make a class method default, and use the square brackets?"
- Previous message: Ajay Kalra: "Re: How to make a class method default, and use the square brackets?"
- Next in thread: Bernd: "Re: C# Raw Socket Issues starting TCP Connections"
- Reply: Bernd: "Re: C# Raw Socket Issues starting TCP Connections"
- Messages sorted by: [ date ] [ thread ]
Date: 17 Mar 2005 07:12:20 -0800
I am working on starting and managing TCP connections manually. I build
the IP headers and TCP packets manually and send them on my own. The
problems I run into seems to be related to the Sockets. Maybe someone
can help me out.
1) I can build the packets and put them out fine, however, I can only
read incomming data if I use IOControl and set the socket SIO_RCVALL.
But doing this seems to apply to other sockets I maybe running in a
diffrent thread.
2) The biggest problem I have seems to be starting a TCP connection. If
I send a SYN, I get a SYN/ACK or SYN/RST like I am suppose to, but for
some reason the Socket replys with a RST with out me doing anything.
Here is how I am building the socket and sending the data...
Socket remote = new Socket(AddressFamily.InterNetwork, SocketType.Raw,
ProtocolType.IP);
remote.Bind(this.l_ipep);
remote.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.ReceiveTimeout, this.timeout_time);
remote.SetSocketOption(SocketOptionLevel.IP,
SocketOptionName.HeaderIncluded, 1);
int ret = remote.IOControl(SIO_RCVALL, oin, oout);
if (BitConverter.ToInt32(oout, 0) != 0) {
return error;
}
...
this.remote.SendTo(ip_packet.get_packet(), this.r_ipep);
What am I doing wrong??? Why does the socket send a RST without me
doing anything? Why can't I read data without setting the socket in
promiscious mode. And why is it that when I do set the socket to
promiscious mode that it seems to apply to other sockets running in
diffrent threads? Thanks.
- Next message: Amiram Korach: "RE: How to make a class method default, and use the square brackets?"
- Previous message: Ajay Kalra: "Re: How to make a class method default, and use the square brackets?"
- Next in thread: Bernd: "Re: C# Raw Socket Issues starting TCP Connections"
- Reply: Bernd: "Re: C# Raw Socket Issues starting TCP Connections"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|