c - getline over a socket -


Is there a libc function that can do the same thing as a getline, but instead of a file, one is formed Will work with socket * stream?

You must call fdopen on a solution socket. There are things that should be kept in mind, while doing so

There is a clear reason for doing this to callline and co-call, but perhaps it is a better idea to rewrite some custom milling?

When you read on a socket, it can return zero values ​​before time. Eg If the kernel buffer is filled up for the TCP socket, then

  can return (fd, buf, bufsize)  

less value than bufsize. In such a situation, it may be necessary to call the job of reading it again, unless it gives zero or negative results.

Thus it is best to avoid stdio work. You need to create a wrapper for the reading function to apply recurricular calls to get the bibSite byte easily for reading. It should return zero values, when no byte can be read from the socket, such as That the file is being read from local disk.

You can find a wrapper in the book by Randall Bryant.

The source code is available on the site. Find out what works starting with RO_


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -