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.
If anybody had such wrong like a 'pnet_sendvar bla bla bla', correct youself pnet_putvar M-file.
- Write "pnet_putvar" instead of "pnet_sendvar" on LINE 46.
Enjoy;)
When the latest version loads,the console output claims that it is version 2.0.5, as that's the version that's hard-coded into pnet.c. Is this merely a cosmetic error?
Comment only