least at this pointthe server is ready to accept connection requests from client programs running on remote machines (or the same machineand falls into an infinite loop-while true (or the equivalent while for older pythons and ex- programmers)-waiting for them to arriveconnectionaddress sockobj accept(waits for the next client connection request to occurwhen it doesthe accept call returns brand-new socket object over which data can be transferred from and to the connected client connections are accepted on sockobjbut communication with client happens on connectionthe new socket this call actually returns two-item tuple--address is the connecting client' internet address we can call accept more than one timeto service multiple client connectionsthat' why each call returns newdistinct socket for talking to particular client once we have client connectionwe fall into another loop to receive data from the client in blocks of up to , bytes at timeand echo each block back to the clientdata connection recv( reads at most , more bytes of the next message sent from client ( coming across the network or ipc connection)and returns it to the script as byte string we get back an empty byte string when the client has finished--end-of-file is triggered when the client closes its end of the socket connection send( 'echo=>datasends the latest byte string data block back to the client programprepending the string 'echo=>to it first the client program can then recv what we send here-the next reply line technically this call sends as much data as possibleand returns the number of bytes actually sent to be fully robustsome programs may need to resend unsent portions or use connection sendall to force all bytes to be sent connection close(shuts down the connection with this particular client transferring byte strings and objects so far we've seen calls used to transfer data in serverbut what is it that is actually shipped through socketas we learned in sockets by themselves always deal in binary byte stringsnot text to your scriptsthis means you must send and will receive bytes stringsnot strthough you can convert to and from text as needed with bytes decode and str encode methods in our scriptswe use bbytes literals to satisfy socket data requirements in other contextstools such as the struct and pickle modules return the byte strings we need automaticallyso no extra steps are needed socket programming