C Client/Server Communicating with fprintf?

The functions that work on FILE s are very unlikely to do what you expect them to do when working on sockets, and are more than likely to mess things up for you. If you want to implement formatting, I'd suggest you roll your own formatting functions to write to the sockets: all you need to do is create a variadic function, call vsprintf to the formatting and send the result over with write or send.

The functions that work on FILEs are very unlikely to do what you expect them to do when working on sockets, and are more than likely to mess things up for you. If you want to implement formatting, I'd suggest you roll your own formatting functions to write to the sockets: all you need to do is create a variadic function, call vsprintf to the formatting and send the result over with write or send...

1 I don't see what problem you're envisioning. The one major issue is with blocking IO. Using stdio with non-blocking mode is not possible; it will result in unrecoverable errors on the FILE.

Therefore I would recommend against using stdio with sockets unless either (1) you only have one connection you're dealing with and no asynchronous events, or (2) you're using threads and don't care if you block. – R.. Jun 9 at 17:14 @R. I read that as using write/send to send data formatted with vsprintf... not sure where the disagreement is :p – pst Jun 9 at 17:30.

How bout using a dup system call, so redirect the stdout to socket descriptor.. so I think you can put your stuff in socket using printf.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions