Re: UDP checksum problem



On Mon, 20 Aug 2007 14:00:25 +0000, r3gis wrote:

Hi !
For some strange reason I cant get correct checksums when I am sending
packets through simple UDP socket.Can anyone tell me what I am doing
wrong ?

The code is following :

int sendUDP(char* buf,int size,char* ip_str,char* port_str) {

int sockfd, portno, ip;
struct sockaddr_in serv_addr;
sockfd = socket(PF_INET, SOCK_DGRAM,0); if (sockfd < 0)
error("ERROR opening socket");
memset((void*)&serv_addr,0,sizeof(struct sockaddr_in));
serv_addr.sin_family=PF_INET;
portno=atoi(port_str);
serv_addr.sin_port = htons(portno);
serv_addr.sin_addr.s_addr=inet_addr(ip_str);
if(serv_addr.sin_addr.s_addr==-1)
error("wrong ip");
int len=sendto(sockfd,buf,size,0,(struct
sockaddr*)&serv_addr,sizeof(serv_addr));
close(sockfd);

return len;
}

I didn't look at this too close.... just wanted to clarify
something first.... you don't have anything to do with the
CRC... that's a built-in feature... ( how ever you want to
phrase it ) are you 100% sure your getting a bad crc error...
where are you seeing this?

jack

--
D.A.M. - Mothers Against Dyslexia

see http://www.jacksnodgrass.com for my contact info.

jack - Grapevine/Richardson
.



Relevant Pages

  • UDP checksum problem
    ... For some strange reason I cant get correct checksums when I am sending ... packets through simple UDP socket.Can anyone tell me what I am doing ... int sockfd, portno, ip; ...
    (comp.os.linux.networking)
  • Re: Oxygenation While Brewing
    ... Stirring - a spoon, a stick, etc. ... Got to give Jack credit for actually having read, understood, and given an answer to the OP's question. ... It's amazing how everyone else either gave partial or totally irrelevant answers (e.g. "vacuum brewers agitate the grounds", "I would solve the acidity problem by roasting darker", "Acidity is not a problem at Jacks ... It was hilarious to see the non-responses, 99 of them, from taking the original poster to task for wanting such an unhealthy food, to suggestions of using packets (as if the o.p. ...
    (alt.coffee)
  • Re: Iptables denies access to web site
    ... Larry Nobs ... The configuration is dsl to dlink router, ... >of all packets coming from the LAN and bound for port 80 to that of the ... >Jack Bowling ...
    (RedHat)
  • I built a firewall that is impossible to hack for 5 bucks
    ... no packets will pass this firewall since the ... network is segmented by a impervious section of air. ...
    (comp.security.firewalls)