Re: how to write a raw socket server using UDP
- From: "H.fazaeli" <fazaeli@xxxxxxxxxxx>
- Date: Wed, 28 Nov 2007 17:17:25 +0330
the 2 most common cause for sendto() failure on raw sockets are:
- badly initialized IP header. note that ip_len and ip_off must be in
host byte order. all other fields must be in net byte order.
- badly initialized destination address.
writing a raw socket server is not much different than other socket
servers:
s = socket(AF_INET, SOCK_RAW, 0);
if (bind(s, ...) != 0)
errx(...)
while (1)
recvfrom(s, ...)
/* recv buffer contains a packet starting with IP header */
sourav das wrote:
hello all,
i m a new comer. i wrote a raw socket client using setsockopt (sock, IPPROTO_IP. IPHDRINCL, ....)using UDP. ihave followed MS_Press network programming . it is showing 19 bytes sent successfully. when trying to send more than 19 bytes using sendto(sock, ...) function , it is showing socket error on sending. i want to know how to write a raw socket server program so that to catch and display the data sent by the client.
thanks a lot,
keep fit,
regards,
spike.
____________________________________________________________________________________
Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- References:
- how to write a raw socket server using UDP
- From: sourav das
- how to write a raw socket server using UDP
- Prev by Date: Re: Updated procstat(1)
- Next by Date: Re: How to add wake on lan support for your card (was: Re: FreeBSD WOL sis on)
- Previous by thread: Re: how to write a raw socket server using UDP
- Next by thread: Updated procstat(1)
- Index(es):