Processing data from a TCP socket - Programming On Unix
Users browsing this thread: 6 Guest(s)
|
|||
Hey there fellow programmers!
I need some help with a program of mine. I need to read chunks of data from a TCP socket, and I can't figure out a smart way to do so. It is a client/server model, using TCP sockets. The client is supposed to send ingormations about files, and the server has to process them. The data for each file is: * filename (arbitrary size, up to PATH_MAX) * sha512 digest for this file (128 bytes) * mtime for this file (arbitrary size, up to 19 bytes) I'm now wondering what could be the best way to send this data from the client to the server, and for the server to process the data. Keeping in mind that I want to be able to send data about multilple files over the same connection (I might have to uses threads here though). So far, the best solution I could think of is to create a structure for each file, and send the full struct over the network. This doesn't seem perfect as it would always send the maximum size for each field in the struct. What do you guys think? PS: Link to the project, if you want to give it a go: http://git.z3bra.org/synk/file/synk.c.html (for now, only the timestamp is send through the socket, as I couldn't find a correct way to handle it) |
|||
Messages In This Thread |
Processing data from a TCP socket - by z3bra - 22-08-2016, 07:12 PM
RE: Processing data from a TCP socket - by venam - 23-08-2016, 12:34 AM
RE: Processing data from a TCP socket - by z3bra - 23-08-2016, 04:21 AM
RE: Processing data from a TCP socket - by venam - 23-08-2016, 04:30 AM
RE: Processing data from a TCP socket - by z3bra - 23-08-2016, 04:53 AM
RE: Processing data from a TCP socket - by venam - 23-08-2016, 05:58 AM
RE: Processing data from a TCP socket - by z3bra - 23-08-2016, 08:51 AM
RE: Processing data from a TCP socket - by z3bra - 23-08-2016, 01:50 PM
RE: Processing data from a TCP socket - by robotchaos - 23-08-2016, 01:57 PM
RE: Processing data from a TCP socket - by z3bra - 23-08-2016, 07:22 PM
RE: Processing data from a TCP socket - by robotchaos - 23-08-2016, 07:26 PM
RE: Processing data from a TCP socket - by z3bra - 24-08-2016, 04:11 AM
RE: Processing data from a TCP socket - by apk - 24-08-2016, 11:33 AM
|