Re: SCTP support



> >Does anyone know if there are plans to add SCTP support to Iperf?

I use this quick & dirty patch. It works only for stream (TCP-like) mode,
and not for packet (UDP-like) mode. Packet mode would require much more
work. It's tested on linux, but should be ok for most other OSs.

Cheers,

Marc.


diff -x *,v -ru iperf-1.7.0/lib/Socket.cpp iperf-1.7.0-marc.sctp/lib/Socket.cpp
--- iperf-1.7.0/lib/Socket.cpp	Wed Feb 26 21:25:28 2003
+++ iperf-1.7.0-marc.sctp/lib/Socket.cpp	Wed Aug 20 17:56:47 2003
 --at--  --at--  -106,7 +106,7  --at--  --at-- 
     SocketAddr serverAddr( inLocalhost, mPort, isIPv6 );
 
     // create an internet TCP socket
-    int type = (mUDP  ?  SOCK_DGRAM  :  SOCK_STREAM);
+    int type = (mUDP  ?  SOCK_SEQPACKET  :  SOCK_STREAM);
     int domain = (serverAddr.isIPv6() ? 
 #ifdef IPV6
                   AF_INET6
 --at--  --at--  -129,7 +129,7  --at--  --at-- 
     } else
 #endif
     {
-        mSock = socket( domain, type, 0 );
+        mSock = socket( domain, type, /* 0 -> SCTP */ 132 );
         FAIL_errno( mSock == INVALID_SOCKET, "socket" );
     } 
 
 --at--  --at--  -165,10 +165,10  --at--  --at-- 
     }
     // listen for connections (TCP only).
     // default backlog traditionally 5
-    if ( ! mUDP ) {
+//    if ( ! mUDP ) {
         rc = listen( mSock, 5 );
         FAIL_errno( rc == SOCKET_ERROR, "listen" );
-    }
+//    }
 
 #ifndef WIN32
     // if multicast, join the group
 --at--  --at--  -217,7 +217,7  --at--  --at-- 
     assert( inHostname != NULL );
 
     // create an internet socket
-    int type = (mUDP  ?  SOCK_DGRAM : SOCK_STREAM);
+    int type = (mUDP  ?  SOCK_SEQPACKET : SOCK_STREAM);
 
     int domain = (serverAddr.isIPv6() ? 
 #ifdef IPV6
 --at--  --at--  -232,7 +232,7  --at--  --at-- 
     fprintf(stderr, "inHostname=%s domain=%d\n", inHostname, domain);
 #endif /* DBG_MJZ */
 
-    mSock = socket( domain, type, 0 );
+    mSock = socket( domain, type, /* 0 -> IPPROTO_SCTP */ 132 );
     FAIL_errno( mSock == INVALID_SOCKET, "socket" );
 
     SetSocketOptions();


Other Mailing lists | Author Index | Date Index | Subject Index | Thread Index