c - strange udp socket sendto behaviour -
i'm trying send data using udp socket , capture data using wireshark (under windows7):
client_sockd= socket(af_inet,sock_dgram,ipproto_ip); client_address.sin_family = af_inet; client_address.sin_addr.s_addr = inet_addr("192.168.3.100"); client_address.sin_port=htons(8015); client_len=sizeof(client_address); int sended = sendto(client_sockd,buf,11,0,(const struct sockaddr *)&client_address,sizeof(client_address));
it's sending packet correct ip dest port becoming 2698. i'm trying change port in code, doesnot have effect real destination port. it's still 2698. how can fix it?
try ipproto_udp
instead of ipproto_ip
:
client_sockd = socket(af_inet, sock_dgram, ipproto_udp);
Comments
Post a Comment