Code limitations

If we execute these scripts and try to connect to that same server from another Terminal, it will simply reject the connection.

The BUFFER_SIZE variable of the 1024 value is the maximum amount of data that can be received at one time. But this does not mean that the function will return 1024 bytes. The send() function also has this behavior. send() returns the number of bytes sent, which may be less than the size of the data that is sent.

Normally in network programming, to make a server handle multiple connections at the same time, concurrency or parallelism is implemented. The problem with concurrency is that it is complicated to make it work. Of course, if an application needs scalability, it is almost an obligation to apply concurrency for the use of more than one processor or kernel. Concurrency aspects will be reviewed in the following chapters. In the next section, we will use something simpler than parallelism that is much easier to use: the selectors library.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset