I've been trying to create a raw socket example and have run across several problems in doing so. The steps I followed are:
Create a raw socket (SOCK_RAW)
Set the socket options to IP_HDRINCL.
Create the IP and TCP headers.
Use sendto() to send the packet.
sendto() returns sizeof ( ipheader ) + sizeof ( tcpheader ), as it should [I think], as there is no data other than the two headers. However, in monitoring the system (I'm sending the packet back to myself), I don't ever receive it. None of the calls ever fail, so I assume there must be something else wrong. Ideas, anyone?
Are you on windows? If so, are you administrator?
Yes and yes.
In that case, I'm out of ideas :P
Run network monitor and see what's actually happening?
Errr....don't you have to specify the destination address in the header?? I don't think sendto will do it for you but I may be mistaken.
Also...what's the deal with SOCK_RD?
Grok: sendto() returns success, but no monitoring tools that I've used have actually seen the packet be sent or received.
Well, that sounds like a problem with your capture tool.
Quote from: CupHead on October 15, 2003, 07:23 AM
Grok: sendto() returns success, but no monitoring tools that I've used have actually seen the packet be sent or received.
Perhaps you are sending it to your own address? Most network monitoring tools don't see traffic that doesn't reach the NIC, such as purely local sockets traffic.
It is being sent back to localhost. I guess I could try it from a different computer.
CupHead since you're probably on some NT variant, you might want to just add some IPs to your current adapter, or add an additional adapter. Under NT you could add an MS Loopback Adapter. I don't know if such an option is available under Win2000 or XP. However, XP supports an alternate configuration for your networking. In this way you can use DHCP for your ISP, and a fixed, local range IP for your programming. A third option would be to install an additional adapter and configure it with private range IPs.
In any of those configurations, be sure to explicitly bind your client and server applications to different IPs.
And even then you might not see anything that's not routed through the real network cards. If it goes through the loopback adapter I'm not sure you'll ever see it. Send it to an internet host!
What Windows are u running off of??
Win 95
Win 98
Win 2000
Win ME
Win XP Home, or Proffesional.
????????
Each system has different for solving there problems.
Um... Windows Server 2003 Enterprise Edition, not that it matters. It's essentially XP, and I've used the most updated information I can find on the subject.
Hmm...
You lost me. I am totally confused. Sorry, I can't help.
Best of Luck.