Ethernet Products
Determine ramifications of Intel® Ethernet products and technologies
4528 Discussions

UDP malformed packets


I'm using NIOS II with TSE MAC and External DDR2 ram. While I got the simple socket server working, I'm having trouble setting up a simple UDP sender and receiver.

My code for the sender task is:

#include <stdio.h> #include <string.h> #include <ctype.h> #include "includes.h" #include "udp_sender.h" #include "alt_error_handler.h" #include "ipport.h" #include "tcpport.h" #include "osport.h"   void UDPSenderTask(){   struct sockaddr_in addr; //static UDPConn conn; int sock; char buf[512];   if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) { alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"UDP Socket creation failed"); }   memset(&addr,0,sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port=htons(UDP_DEST); addr.sin_addr.s_addr= inet_addr("");   char str[5] = "hello";   if(sendto(sock,str,5,0,(struct sockaddr*) &addr,sizeof(from)) < 0) { printf("UDP send failed"); }   close(sock); return; }

Eclipse gives me Implicit definition on inet_addr() and on Wireshark I get malformed packet. How can I resolve this issue?



0 Kudos
1 Reply
Hi, As Intel FPGA only supply IP core till Ethernet MAC (datalink layer), this Intel forum may not be the best place for you to search for answer or debug suggestion on TCP/UDP (transport layer) questions. I tried search "NIOS UDP" in this Intel forum and found below example design from the replied on below forum questions It may not be exactly the answer that you are looking for but feel free to check it out. Like wise, I would recommend you to post your questions in rocket board forum. That's the better community to discuss about the issue that you are facing. Thanks. Regards, dlim
0 Kudos