Rank: 80855 based on 0 downloads (last 30 days) and 0 file submitted
photo

anon donor

E-mail

Personal Profile:

 

Watch this Author's files

 

Comments and Ratings by anon donor
Updated File Comments Rating
13 Mar 2010 TCP/UDP/IP Toolbox 2.0.6 TCP/IP connections or UDP packets in MATLAB Author: Peter Rydes├Ąter

I was able to achieve >512mbps (that's 0.5 gigabit/sec) of read or write by modifying pnet.c as follows, and recompiling the mex extention:

---- edit of pnet.c start here----------------
int tcp_connect(const char *hostname,const int port)
{
+ int optval;
+ int result=0;

if(ipv4_lookup(hostname,port)==-1)
return -1;
con[con_index].fid=socket(AF_INET, SOCK_STREAM, 0);

+ optval=1;
+ result = setsockopt(con[con_index].fid, +IPPROTO_TCP,TCP_NODELAY,(char *) &optval,sizeof(optval));
+ optval = 512*1024;
+ result = setsockopt(con[con_index].fid, SOL_SOCKET,SO_SNDBUF,(char *) &optval,sizeof(optval));
+ result = setsockopt(con[con_index].fid, SOL_SOCKET,SO_RCVBUF,(char *) &optval,sizeof(optval));

---- edit of pnet.c ends here----------------

with the modified pnet, executing pnet read/write calls using a buffer of 512kbytes gave very high throughput.

Thank you very much peter , for contributing this and sharing
the source, it's been very useful.

Contact us