From: <ha...@us...> - 2009-08-02 17:23:55
|
Revision: 6070 http://octave.svn.sourceforge.net/octave/?rev=6070&view=rev Author: hauberg Date: 2009-08-02 17:23:45 +0000 (Sun, 02 Aug 2009) Log Message: ----------- Use G-macros instead of FS-macros (from Jeff Keacher) Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2009-07-30 19:09:15 UTC (rev 6069) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2009-08-02 17:23:45 UTC (rev 6070) @@ -202,7 +202,7 @@ // This macro must start with DEFUN_DLD so that the automatic collection // of function helps can take place. #define DEFUN_DLD_SOCKET_CONSTANT(name, help ) \ -DEFUNX_DLD ( #name, F ## name, FS ## name, args, nargout, help) \ +DEFUNX_DLD ( #name, F ## name, G ## name, args, nargout, help) \ { return octave_value( name ); }; // PKG_ADD: autoload ("AF_UNIX", "sockets.oct"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pau...@us...> - 2009-08-22 10:16:31
|
Revision: 6128 http://octave.svn.sourceforge.net/octave/?rev=6128&view=rev Author: paulsundvall Date: 2009-08-22 10:16:23 +0000 (Sat, 22 Aug 2009) Log Message: ----------- Fixed two memory leaks with one missing delete[], one delete[] instead of delete. Added error check on the user requesting negative receive length. Fixed copy/paste mistake(?) in error message. Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2009-08-22 07:50:34 UTC (rev 6127) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2009-08-22 10:16:23 UTC (rev 6128) @@ -534,7 +534,7 @@ for ( int i = 0 ; i < d1.length() ; i++ ) buf[i] = (unsigned char)d1(i); retval = ::send( s->get_sock_fd(), (const char*)buf, data.byte_size(), 0 ); - delete buf; + delete[] buf; } else { @@ -577,11 +577,14 @@ } else { - error("connect: expecting a octave_socket or integer"); + error("recv: expecting a octave_socket or integer"); return octave_value(-1); } long len = args(1).int_value(); + if(len<0) + error("recv: negative receive length requested"); + unsigned char* buf = new unsigned char[ len ]; #ifndef __WIN32__ retval = ::recv( s->get_sock_fd(), buf, len, flags ); @@ -594,6 +597,8 @@ for ( int i = 0 ; i < retval ; i++ ) return_buf(0,i) = buf[i]; + delete[] buf; + octave_value in_buf(return_buf); octave_value out_buf; OCTAVE_TYPE_CONV( in_buf, out_buf, uint8 ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pau...@us...> - 2009-08-27 14:52:48
|
Revision: 6157 http://octave.svn.sourceforge.net/octave/?rev=6157&view=rev Author: paulsundvall Date: 2009-08-27 14:52:42 +0000 (Thu, 27 Aug 2009) Log Message: ----------- Clarified function documentation as displayed by the octave help command. Corrected typo from likely copy/paste error. Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2009-08-27 11:33:52 UTC (rev 6156) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2009-08-27 14:52:42 UTC (rev 6157) @@ -299,7 +299,9 @@ // PKG_ADD: autoload ("socket", "sockets.oct"); // Function to create a socket -DEFUN_DLD(socket,args,nargout,"socket(int,int,int)\nSee the socket() man pages\n") +DEFUN_DLD(socket,args,nargout, + "socket(int,int,int)\n" + "See the socket() man pages\n") { int domain = AF_INET; int type = SOCK_STREAM; @@ -358,7 +360,8 @@ // PKG_ADD: autoload ("connect", "sockets.oct"); // function to create an outgoing connection DEFUN_DLD(connect,args,nargout, \ - "connect(octave_socket,struct)\nSee the connect() man pages") + "connect(octave_socket,struct)\n" + "See the connect() man pages\n") { int retval = -1; struct sockaddr_in serverInfo; @@ -425,7 +428,8 @@ // PKG_ADD: autoload ("disconnect", "sockets.oct"); // function to disconnect asocket DEFUN_DLD(disconnect,args,nargout, \ - "disconnect(octave_socket)\nSince we can't call fclose on the fd directly, use this to disconnect") + "disconnect(octave_socket)\n" + "Since we can't call fclose on the fd directly, use this to disconnect") { // Determine the socket on which to operate octave_socket* s = NULL; @@ -454,7 +458,8 @@ // PKG_ADD: autoload ("gethostbyname", "sockets.oct"); // function to get a host number from a host name DEFUN_DLD(gethostbyname,args,nargout, \ - "gethostbyname(string)\nSee the gethostbyname() man pages") + "gethostbyname(string)\n" + "See the gethostbyname() man pages") { int nargin = args.length (); struct hostent* hostInfo = NULL; @@ -486,8 +491,9 @@ // PKG_ADD: autoload ("send", "sockets.oct"); // function to send data over a socket DEFUN_DLD(send,args,nargout, \ - "send(octave_socket,octave_value)\nSee the send() man pages. This will only allow the" \ - " user to send uint8 arrays or strings") + "send(octave_socket,octave_value,flags)\n" + "See the send() man pages. This will only allow the\n" + "user to send uint8 arrays or strings\n") { int retval = 0; int flags = 0; @@ -548,8 +554,9 @@ // PKG_ADD: autoload ("recv", "sockets.oct"); // function to receive data over a socket DEFUN_DLD(recv,args,nargout, \ - "recv(octave_socket,int)\nSee the send() man pages. This will only allow the" \ - " user to receive uint8 arrays or strings") + "recv(octave_socket,len,flags)\n" + "See the recv() man pages. This will only allow the" \ + " user to receive uint8 arrays or strings\n") { int retval = 0; int flags = 0; @@ -612,8 +619,9 @@ // PKG_ADD: autoload ("bind", "sockets.oct"); // function to bind a socket DEFUN_DLD(bind,args,nargout, \ - "bind(octave_socket,int)\nSee the bind() man pages. This will bind a socket to a" \ - " specific port") + "bind(octave_socket,int)\n" + "See the bind() man pages. This will bind a socket to a" \ + " specific port\n") { int retval = 0; if ( args.length() < 2 ) @@ -656,7 +664,8 @@ // PKG_ADD: autoload ("listen", "sockets.oct"); // function to listen on a socket DEFUN_DLD(listen,args,nargout, \ - "listen(octave_socket,int)\nSee the listen() man pages") + "listen(octave_socket,int)\n" + "See the listen() man pages\n") { int retval = 0; if ( args.length() < 2 ) @@ -695,7 +704,8 @@ // PKG_ADD: autoload ("accept", "sockets.oct"); // function to accept on a listening socket DEFUN_DLD(accept,args,nargout, \ - "accept(octave_socket)\nSee the accept() man pages") + "accept(octave_socket)\n" + "See the accept() man pages\n") { int retval = 0; struct sockaddr_in clientInfo; @@ -761,7 +771,7 @@ // PKG_ADD: autoload ("load_socket_constants", "sockets.oct"); // function to load socket constants DEFUN_DLD(load_socket_constants,args,nargout, \ - "Loads various socket constants like AF_INET, SOCK_STREAM, etc.") + "Loads various socket constants like AF_INET, SOCK_STREAM, etc.\n") { octave_socket temp(); return octave_value(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pau...@us...> - 2012-07-03 09:56:26
|
Revision: 10712 http://octave.svn.sourceforge.net/octave/?rev=10712&view=rev Author: pauldreik Date: 2012-07-03 09:56:20 +0000 (Tue, 03 Jul 2012) Log Message: ----------- modifed the AF_LOCAL macro on win32 platforms, which was misspelled. Credit to Carlo de Falco for spotting it. Also, made it use the newer octave>3.2 variant of DEFUNX_DLD macro. windows users of older octave versions may not be able to see the function which is most likely not a big problem. Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2012-07-02 12:24:31 UTC (rev 10711) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2012-07-03 09:56:20 UTC (rev 10712) @@ -240,8 +240,9 @@ // PKG_ADD: autoload ("AF_LOCAL", "sockets.oct"); DEFUN_DLD_SOCKET_CONSTANT(AF_LOCAL, "socket constant" ); #else -DEFUNX_DLD ( "AF_LOCAL", FAFL_OCAL, FSAF_LOCAL, args, nargout, "socket constant" ) -{ error( "AF_LOCAL address family not supported on this platform" ); return octave_value(); }; +DEFUNX_DLD ("AF_LOCAL", FAF_LOCAL, GAF_LOCAL, args, nargout, "(not supported)") +{ error( "AF_LOCAL address family not supported on this platform" ); + return octave_value(); }; #endif // PKG_ADD: autoload ("AF_INET", "sockets.oct"); DEFUN_DLD_SOCKET_CONSTANT(AF_INET, "socket constant" ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pau...@us...> - 2009-08-27 15:55:57
|
Revision: 6158 http://octave.svn.sourceforge.net/octave/?rev=6158&view=rev Author: paulsundvall Date: 2009-08-27 15:55:47 +0000 (Thu, 27 Aug 2009) Log Message: ----------- Clarified help texts. Corrected behaviour when recv() returns negative, which would create a "error: memory exhausted or requested size too large for range of Octave's index type" otherwise. Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2009-08-27 14:52:42 UTC (rev 6157) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2009-08-27 15:55:47 UTC (rev 6158) @@ -300,8 +300,16 @@ // PKG_ADD: autoload ("socket", "sockets.oct"); // Function to create a socket DEFUN_DLD(socket,args,nargout, - "socket(int,int,int)\n" - "See the socket() man pages\n") + "s=socket(domain,type,protocol)\n" + "Creates a socket. Domain is an integer, where the value AF_INET\n" + "can be used to create an IPv4 socket.\n" + "type is an integer describing the socket. When using IP, specifying " + "SOCK_STREAM gives a TCP socket.\n" + "protocol is currently not used and should be 0 if specified.\n" + "\n" + "If no input arguments are given, default values AF_INET and \n" + "SOCK_STREAM are used.\n" + "See the local socket() reference for more details\n") { int domain = AF_INET; int type = SOCK_STREAM; @@ -360,8 +368,16 @@ // PKG_ADD: autoload ("connect", "sockets.oct"); // function to create an outgoing connection DEFUN_DLD(connect,args,nargout, \ - "connect(octave_socket,struct)\n" - "See the connect() man pages\n") + "status=connect(sock,serverinfo)\n" + "Connects the socket given in sock following the information\n" + "given in the struct serverinfo\n" + "serverinfo shall contain the following fields:\n" + " addr - a string with the host name to connect to\n" + " port - the port number to connect to (an integer)\n" + "\n" + "On successful connect, zero is returned in status.\n" + "\n" + "See the connect() man pages for further details.\n") { int retval = -1; struct sockaddr_in serverInfo; @@ -554,9 +570,15 @@ // PKG_ADD: autoload ("recv", "sockets.oct"); // function to receive data over a socket DEFUN_DLD(recv,args,nargout, \ - "recv(octave_socket,len,flags)\n" - "See the recv() man pages. This will only allow the" \ - " user to receive uint8 arrays or strings\n") + "[data,count]=recv(sock,len,flags)\n" + "Requests reading len bytes from the socket given in sock.\n" + "The integer flags parameter can be used to modify the behaviour\n" + "of recv.\n" + "\n" + "The read data is returned in an uint8 array data. The number of\n" + "bytes read is returned in count\n" + "\n" + "See the recv() man pages for further details.\n") { int retval = 0; int flags = 0; @@ -599,20 +621,30 @@ retval = ::recv( s->get_sock_fd(), ( char* )buf, len, flags ); #endif - Matrix return_buf(1,retval); + octave_value_list return_list; - for ( int i = 0 ; i < retval ; i++ ) - return_buf(0,i) = buf[i]; + //always return the status in the second output parameter + return_list(1) = retval; + if(retval<0) { + //We get -1 if an error occurs,or if there is no data and the + //socket is non-blocking. We should return in both cases. + } else if (0==retval) { + //The peer has shut down. + } else { + //Normal behaviour. + Matrix return_buf(1,retval); + + for ( int i = 0 ; i < retval ; i++ ) + return_buf(0,i) = buf[i]; + + octave_value in_buf(return_buf); + octave_value out_buf; + OCTAVE_TYPE_CONV( in_buf, out_buf, uint8 ); + return_list(0) = out_buf; + } delete[] buf; - - octave_value in_buf(return_buf); - octave_value out_buf; - OCTAVE_TYPE_CONV( in_buf, out_buf, uint8 ); - return_list(0) = out_buf; - //return_list(0) = return_buf; - return_list(1) = retval; - + return return_list; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ha...@us...> - 2011-02-20 08:50:41
|
Revision: 8124 http://octave.svn.sourceforge.net/octave/?rev=8124&view=rev Author: hauberg Date: 2011-02-20 08:50:35 +0000 (Sun, 20 Feb 2011) Log Message: ----------- Make the code compile with Octave 3.4 Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2011-02-20 08:28:44 UTC (rev 8123) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2011-02-20 08:50:35 UTC (rev 8124) @@ -413,9 +413,36 @@ const octave_base_value& struct_serverInfo = args(1).get_rep(); octave_struct& addrInfo = ((octave_struct&)struct_serverInfo); +#if MINORVERSION <= 2 string addr = addrInfo.map_value().stringfield("addr"); int port = addrInfo.map_value().intfield("port"); +#else + const Cell addr_cell = addrInfo.map_value().getfield ("addr"); + string addr; + if (addr_cell.numel () == 1 && addr_cell (0).is_string ()) + { + addr = addr_cell (0).string_value (); + } + else + { + error ("connect: invalid input: no 'addr' field"); + return octave_value (-1); + } + const Cell port_cell = addrInfo.map_value().getfield ("port"); + int port; + if (port_cell.numel () == 1 && port_cell (0).is_numeric_type ()) + { + port = port_cell (0).int_value (); + } + else + { + error ("connect: invalid input: no 'port' field"); + return octave_value (-1); + } +#endif + + // Determine the socket on which to operate octave_socket* s = NULL; if ( args(0).type_id() == octave_socket::static_type_id() ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gof...@us...> - 2011-09-05 21:03:58
|
Revision: 8504 http://octave.svn.sourceforge.net/octave/?rev=8504&view=rev Author: goffioul Date: 2011-09-05 21:03:51 +0000 (Mon, 05 Sep 2011) Log Message: ----------- Fix Win32 compilation for MinGW. Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2011-09-05 19:36:46 UTC (rev 8503) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2011-09-05 21:03:51 UTC (rev 8504) @@ -255,12 +255,14 @@ // PKG_ADD: autoload ("MSG_PEEK", "sockets.oct"); DEFUN_DLD_SOCKET_CONSTANT(MSG_PEEK, "socket constant" ); -#ifndef __WIN32__ +#ifdef MSG_DONTWAIT // PKG_ADD: autoload ("MSG_DONTWAIT", "sockets.oct"); DEFUN_DLD_SOCKET_CONSTANT(MSG_DONTWAIT, "socket constant" ); #endif +#ifdef MSG_WAITALL // PKG_ADD: autoload ("MSG_WAITALL", "sockets.oct"); DEFUN_DLD_SOCKET_CONSTANT(MSG_WAITALL, "socket constant" ); +#endif std::map< int, octave_socket * > socket_map; static bool type_loaded = false; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pau...@us...> - 2012-06-21 08:51:57
|
Revision: 10651 http://octave.svn.sourceforge.net/octave/?rev=10651&view=rev Author: pauldreik Date: 2012-06-21 08:51:48 +0000 (Thu, 21 Jun 2012) Log Message: ----------- minor change to build with gcc 4.7 Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2012-06-21 07:41:04 UTC (rev 10650) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2012-06-21 08:51:48 UTC (rev 10651) @@ -50,9 +50,7 @@ #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> -#ifdef __CYGWIN__ #include <unistd.h> -#endif #else typedef unsigned int socklen_t; #include <winsock2.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pau...@us...> - 2012-06-21 09:12:26
|
Revision: 10652 http://octave.svn.sourceforge.net/octave/?rev=10652&view=rev Author: pauldreik Date: 2012-06-21 09:12:15 +0000 (Thu, 21 Jun 2012) Log Message: ----------- update of documentation strings Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2012-06-21 08:51:48 UTC (rev 10651) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2012-06-21 09:12:15 UTC (rev 10652) @@ -340,7 +340,7 @@ // Function to create a socket DEFUN_DLD(socket,args,nargout, "s=socket(domain,type,protocol)\n" - "Creates a socket. Domain is an integer, where the value AF_INET\n" + "Creates a socket s. Domain is an integer, where the value AF_INET\n" "can be used to create an IPv4 socket.\n" "type is an integer describing the socket. When using IP, specifying " "SOCK_STREAM gives a TCP socket.\n" @@ -348,7 +348,7 @@ "\n" "If no input arguments are given, default values AF_INET and \n" "SOCK_STREAM are used.\n" - "See the local socket() reference for more details\n") + "See the local socket() reference for more details.\n") { int domain = AF_INET; int type = SOCK_STREAM; @@ -407,14 +407,14 @@ // PKG_ADD: autoload ("connect", "sockets.oct"); // function to create an outgoing connection DEFUN_DLD(connect,args,nargout, \ - "status=connect(sock,serverinfo)\n" - "Connects the socket given in sock following the information\n" - "given in the struct serverinfo\n" + "status=connect(s,serverinfo)\n" + "Connects the socket s following the information\n" + "in the struct serverinfo.\n" "serverinfo shall contain the following fields:\n" " addr - a string with the host name to connect to\n" " port - the port number to connect to (an integer)\n" "\n" - "On successful connect, zero is returned in status.\n" + "On successful connect, the returned status is zero.\n" "\n" "See the connect() man pages for further details.\n") { @@ -422,9 +422,9 @@ struct sockaddr_in serverInfo; struct hostent* hostInfo; - if ( args.length() < 2 ) + if ( args.length() != 2 ) { - error("connect: you must specify 2 paramters"); + error("connect: you must specify 2 parameters."); return octave_value(-1); } @@ -444,7 +444,7 @@ } else { - error ("connect: invalid input: no 'addr' field"); + error ("connect: invalid input: no 'addr' field in serverinfo."); return octave_value (-1); } @@ -456,7 +456,7 @@ } else { - error ("connect: invalid input: no 'port' field"); + error ("connect: invalid input: no 'port' field in serverinfo."); return octave_value (-1); } #endif @@ -476,7 +476,7 @@ } else { - error("connect: expecting a octave_socket or integer"); + error("connect: expecting an octave_socket or integer"); return octave_value(-1); } @@ -510,8 +510,10 @@ // PKG_ADD: autoload ("disconnect", "sockets.oct"); // function to disconnect asocket DEFUN_DLD(disconnect,args,nargout, \ - "disconnect(octave_socket)\n" - "Since we can't call fclose on the fd directly, use this to disconnect") + "disconnect(s)\n" + "Disconnects the socket s.\n" + "Since we can't call fclose on the file descriptor directly,\n" + "use this function to disconnect the socket.") { // Determine the socket on which to operate octave_socket* s = NULL; @@ -527,7 +529,7 @@ } else { - error("connect: expecting a octave_socket or integer"); + error("connect: expecting an octave_socket or integer"); return octave_value(-1); } @@ -540,8 +542,13 @@ // PKG_ADD: autoload ("gethostbyname", "sockets.oct"); // function to get a host number from a host name DEFUN_DLD(gethostbyname,args,nargout, \ - "gethostbyname(string)\n" - "See the gethostbyname() man pages") + "addr=gethostbyname(hostname)\n" + "Returns an IP adress addr for a host name.\n" + "Example:\n" + "addr=gethostbyname('localhost')\n" + "addr = 127.0.0.1\n" + "\n" + "See the gethostbyname() man pages for details.") { int nargin = args.length (); struct hostent* hostInfo = NULL; @@ -573,16 +580,17 @@ // PKG_ADD: autoload ("send", "sockets.oct"); // function to send data over a socket DEFUN_DLD(send,args,nargout, \ - "send(octave_socket,octave_value,flags)\n" - "See the send() man pages. This will only allow the\n" - "user to send uint8 arrays or strings\n") + "send(s,data,flags)\n" + "Sends data on socket s. data should be an uint8 array or\n" + "a string.\n" + "See the send() man pages for further details.\n") { int retval = 0; int flags = 0; if ( args.length() < 2 ) { - error( "send: you must specify 2 parameters"); + error( "send: you must specify two or more parameters"); return octave_value(-1); } @@ -604,7 +612,7 @@ } else { - error("connect: expecting a octave_socket or integer"); + error("connect: expecting an octave_socket or integer"); return octave_value(-1); } @@ -636,8 +644,8 @@ // PKG_ADD: autoload ("recv", "sockets.oct"); // function to receive data over a socket DEFUN_DLD(recv,args,nargout, \ - "[data,count]=recv(sock,len,flags)\n" - "Requests reading len bytes from the socket given in sock.\n" + "[data,count]=recv(s,len,flags)\n" + "Requests reading len bytes from the socket s.\n" "The integer flags parameter can be used to modify the behaviour\n" "of recv.\n" "\n" @@ -645,7 +653,7 @@ "bytes read is returned in count\n" "\n" "You can get non-blocking operation by using the flag MSG_DONTWAIT\n" - "which makes the recv() call return immediately. If there is no\n" + "which makes the recv() call return immediately. If there are no\n" "data, -1 is returned.\n" "See the recv() man pages for further details.\n") { @@ -675,7 +683,7 @@ } else { - error("recv: expecting a octave_socket or integer"); + error("recv: expecting an octave_socket or integer"); return octave_value(-1); } @@ -722,12 +730,12 @@ // PKG_ADD: autoload ("bind", "sockets.oct"); // function to bind a socket DEFUN_DLD(bind,args,nargout, \ - "bind(octave_socket,int)\n" - "See the bind() man pages. This will bind a socket to a" \ - " specific port\n") + "bind(s,portnumber)\n" + "binds the sockets to port portnumber.\n" + "See the bind() man pages for further details.\n") { int retval = 0; - if ( args.length() < 2 ) + if ( args.length() != 2 ) { error( "bind: you must specify 2 parameters" ); return octave_value(-1); @@ -747,7 +755,7 @@ } else { - error("connect: expecting a octave_socket or integer"); + error("connect: expecting an octave_socket or integer"); return octave_value(-1); } @@ -767,11 +775,15 @@ // PKG_ADD: autoload ("listen", "sockets.oct"); // function to listen on a socket DEFUN_DLD(listen,args,nargout, \ - "listen(octave_socket,int)\n" - "See the listen() man pages\n") + "r=listen(s,backlog)\n" + "Listens on socket s for connections. backlog specifies\n" + "how large the queue of incoming connections is allowed to\n" + "grow.\n" + "On success, zero is returned.\n" + "See the listen() man pages for details.\n") { int retval = 0; - if ( args.length() < 2 ) + if ( args.length() != 2 ) { error( "listen: you must specify 2 parameters" ); return octave_value(-1); @@ -791,7 +803,7 @@ } else { - error("connect: expecting a octave_socket or integer"); + error("connect: expecting an octave_socket or integer"); return octave_value(-1); } @@ -807,8 +819,11 @@ // PKG_ADD: autoload ("accept", "sockets.oct"); // function to accept on a listening socket DEFUN_DLD(accept,args,nargout, \ - "accept(octave_socket)\n" - "See the accept() man pages\n") + "[client,info]=accept(s)\n" + "Accepts an incoming connection on the socket s.\n" + "The newly created socket is returned in client, and\n" + "associated information in a struct info.\n" + "See the accept() man pages for details.\n") { int retval = 0; struct sockaddr_in clientInfo; @@ -834,7 +849,7 @@ } else { - error("accept: expecting a octave_socket or integer"); + error("accept: expecting an octave_socket or integer"); return octave_value(-1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pau...@us...> - 2012-06-27 20:33:56
|
Revision: 10700 http://octave.svn.sourceforge.net/octave/?rev=10700&view=rev Author: pauldreik Date: 2012-06-27 20:33:49 +0000 (Wed, 27 Jun 2012) Log Message: ----------- Removed unused member function is_data_available() which was undefined Removed unused variable. Modified Paths: -------------- trunk/octave-forge/main/sockets/src/sockets.cc Modified: trunk/octave-forge/main/sockets/src/sockets.cc =================================================================== --- trunk/octave-forge/main/sockets/src/sockets.cc 2012-06-27 15:29:06 UTC (rev 10699) +++ trunk/octave-forge/main/sockets/src/sockets.cc 2012-06-27 20:33:49 UTC (rev 10700) @@ -148,7 +148,7 @@ bool print_as_scalar (void) const { return true;} // Still undefined. - bool is_data_available() {}; + //bool is_data_available() {}; /** * Overloaded methods to print the fd as the socket id @@ -825,7 +825,6 @@ "associated information in a struct info.\n" "See the accept() man pages for details.\n") { - int retval = 0; struct sockaddr_in clientInfo; socklen_t clientLen = sizeof(struct sockaddr_in); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |