network programming and sockets send(string [flags]sends data in string to connected socket the optional flags argument has the same meaning as for recv()described earlier returns the number of bytes sentwhich may be fewer than the number of bytes in string raises an exception if an error occurs sendall(string [flags]sends data in string to connected socketexcept that an attempt is made to send all of the data before returning returns none on successraises an exception on failure flags has the same meaning as for send( sendto(string [flags]addresssends data to the socket flags has the same meaning as for recv(address is tuple of the form (hostport)which specifies the remote address the socket should not already be connected returns the number of bytes sent this function is primarily used in conjunction with the udp protocol setblocking(flagif flag is zerothe socket is set to nonblocking mode otherwisethe socket is set to blocking mode (the defaultin nonblocking modeif recv(call doesn' find any data or if send(call cannot immediately send the datathe socket error exception is raised in blocking modethese calls block until they can proceed setsockopt(leveloptnamevaluesets the value of the given socket option level and optname have the same meaning as for getsockopt(the value can be an integer or string representing the contents of buffer in the latter caseit' up to the caller to ensure that the string contains the proper data see getsockopt(for socket option namesvaluesand descriptions settimeout(timeoutsets timeout on socket operations timeout is floating-point number in seconds value of none means no timeout if timeout occursa socket timeout exception is raised as general ruletimeouts should be set as soon as socket is created because they can be applied to operations involved in establishing connection (such as connect() shutdown(howshuts down one or both halves of the connection if how is further receives are disallowed if how is further sends are disallowed if how is further sends and receives are disallowed in addition to these methodsa socket instance also has the following read-only properties which correspond to the arguments passed to the socket(function property description family proto type the socket address family ( af_inetthe socket protocol the socket type ( sock_streamf lib fl ff