Nios® II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.

Ethernet transmission speed

Altera_Forum
Honored Contributor I
756 Views

My board:DE2-115 

My sopc project:webserver(RGMII)(provided by Terasic) 

My nios project: simple socket server 

 

Now, I can send some words to my PC from my board by a debugging assistant software. 

However, the speed(working on 100Mbps) is faster than the speed working on 1000Mbps. 

 

What I can do to raise the transfer speed? 

Why the 1000Mbps is slower than 100Mbps, is it because my debugging assistant software doesn't support 1000Mbps or something else??
0 Kudos
3 Replies
Altera_Forum
Honored Contributor I
54 Views

What kind of socket are you using? If it is TCP then it is possible that an increase in packet loss due to the higher speed results in a slower effective speed on the socket. 

Use a sniffer software such as Wireshark to see if there is any retransmission.
Altera_Forum
Honored Contributor I
54 Views

Yeah, as you mentioned, my socket is TCP. 

Should I change it to UDP or can I do something to improve the existing situation by changing TCP Socket? 

 

******************my code in NIOS II******************# include <stdio.h># include <string.h># include <ctype.h># include "includes.h"# include "simple_socket_server.h"# include "alt_error_handler.h"# include "ipport.h"# include "tcpport.h"# define MAXDATASIZE 1450 

 

void SSSSimpleSocketServerTask() 

int fd_listen;// max_socket 

int fd_listen1; 

int long bytes_sent; 

int long bytes_recv; 

int nSendBufSize=SSS_TX_BUF_SIZE; 

struct sockaddr_in server_addr; 

struct sockaddr_in client_addr; 

fd_listen = socket(AF_INET, SOCK_STREAM, 0); 

setsockopt(fd_listen,SOL_SOCKET,SO_SNDBUF,(char * )&nSendBufSize,sizeof(int)); 

if (fd_listen< 0)  

alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] Socket creation failed"); 

else 

printf("Socket created"); 

server_addr.sin_family = AF_INET; 

server_addr.sin_port = htons(SSS_PORT); 

server_addr.sin_addr.s_addr = INADDR_ANY; 

memset(&(server_addr.sin_zero), '\0', 8); 

if ((bind(fd_listen,(struct sockaddr *)&server_addr,sizeof(server_addr))) < 0) 

alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] Bind failed"); 

else 

printf("Bind is OK\n"); 

if ((listen(fd_listen,5)) < 0) 

alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] Listen failed"); 

else 

printf("Listen is OK\n"); 

int client_addrlen; 

client_addrlen=sizeof(client_addr); 

fd_listen1 = accept(fd_listen,(struct sockaddr *)&client_addr,&client_addrlen); 

while(1) 

if(fd_listen1<0) 

alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] Accept creation failed"); 

else 

printf("accepted connection request\n"); 

fd_listen = fd_listen1; 

break; 

printf("Server: Sending some test data to client...\n"); 

char sendbuf[MAXDATASIZE] = "Bjtuxuxu Love FPGA!"; 

char recvbuf[200] = "Bjtu"; 

while(1) 

bytes_sent = send(fd_listen,sendbuf,SSS_BUF_LEN,0); 

if(bytes_sent<0) 

alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] Send failed"); 

else 

printf("SERVER : Send is OK \n"); 

printf("SERVER : Bytes sent:%ld.\n",bytes_sent); 

bytes_recv = recv(fd_listen,recvbuf,200,0); 

if(bytes_recv<0) 

alt_NetworkErrorHandler(EXPANDED_DIAGNOSIS_CODE,"[sss_task] Recv failed"); 

else 

printf("SERVER: recv() is OK.\n"); 

printf("SERVER: Received data is: \"%s\"\n", recvbuf); 

printf("SERVER: Bytes received: %ld.\n", bytes_recv); 

return ; 

 

******************my code in NIOS II****************** 

Thanks for your reply.
Altera_Forum
Honored Contributor I
54 Views

It depends on your needs. UDP is usually faster and has a lower latency, but you have no guarantee a packet you send will even be received. If you need something safer and need all your data to be transmitted, and retransmitted if necessary, then you should use TCP. 

To know what the problem is, you need to analyse the traffic with a sniffer such as Wireshark and see what's wrong.
Reply