hello forum ,
I am trying to send an empty UDP packet from my microcontroller to VB6 winsock
wireshark "sees" the packets going
IP frame and checksum is ok
I set UDP checksum field to 0x0
sender and receiver port is same 1024
sender IP 192.168.1.100 receiver IP 192.168.1.2
however winsock never gets into the data_arrival subroutine
my OS is XP and I disabled windows firewall
this time I tried to send "hello" from my laptop - it receives OK
what can I do to receive the packets from my microcontroller ?
thank you
here is the micro's code
==========0===========
I am trying to send an empty UDP packet from my microcontroller to VB6 winsock
wireshark "sees" the packets going
IP frame and checksum is ok
I set UDP checksum field to 0x0
sender and receiver port is same 1024
sender IP 192.168.1.100 receiver IP 192.168.1.2
however winsock never gets into the data_arrival subroutine
my OS is XP and I disabled windows firewall
this time I tried to send "hello" from my laptop - it receives OK
what can I do to receive the packets from my microcontroller ?
thank you
here is the micro's code
==========0===========
Code:
void send_UDP_frame(void)
{
frame_counter++;
uip_len = sizeof(struct eth_header); //get struct header len = 42
memcpy(frame->ether_dest, &destmac, 6); //0xff = broadcast
memcpy(frame->ether_src, &mymac, 6);
frame->ether_type = HTONS(0x0800); //IP following
frame->vhl = 0x45; //IP4, 20byte header
frame->tos = 0x00; //
frame->len = HTONS(28 + data_len);
frame->ipid = HTONS(frame_counter);//
frame->ipoffset = HTONS(0);
frame->ttl = 0x80; //time to live
frame->proto = 0x11; //UDP (17)
frame->ipchksum = 0; //reset checksum (will be calculated and inserted later)
memcpy(frame->srcipaddr, &s_ip,4); //insert source ip
memcpy(frame->destipaddr,&d_ip,4); //insert dest ip
//calculate IP4 header checksum
frame->ipchksum=~uip_chksum((uint16_t*)&uip_buf[14],20); //20 byte header checksum
frame->srcport = HTONS(1024); //source port
frame->destport = HTONS(1024 ); //destination port
frame->udplen = HTONS(data_len+8); //data len + 8 byte udp header