- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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("192.168.1.20");
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?
Thanks
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
https://forums.intel.com/s/question/0D50P00003yyMVFSA2/tse-with-udp-without-nios
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.
https://forum.rocketboards.org/
Thanks.
Regards,
dlim
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page