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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -