c - sending formatted messages across TCP connection -


I have an existing program that prints many messages for standard error:

  Fprintf (stderr, ...  

I would like to modify this program so that these messages can be sent to a TCP connection on the Internet (which I have already created SOCK_STREAM socket.) The best way to format messages such as they are by FRPINF and then enclosing them. Send it to the rennet?

Of course, before I can send a message, I have to first know how long it is, so I can send the length to the customer first, so the customer will know that How many bytes to read ...

Any idea will be most appreciated!

Once you have connected your socket, you can open it on the socket file as the stream using fdopen () . This gives you a FILE * that you can pass fprintf () to stderr


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -