Processing data from a TCP socket - Programming On Unix
Users browsing this thread: 5 Guest(s)
|
|||
The structure would look like this:
Code: struct metadata { By using a structure, I don't need to pass everything as a string. The conversion to "strings" will then be done on the server side. The above would result in a packet size of 255 + 64 + 8 = 327 bytes. That's totally acceptable in the end. As my "biggest" values are still low, I don't think it's worth passing the length along. The size might be arbitrary, but in this case I'll be passing the maximum size for each field. For example, even if my filename is only "/etc/profile", I'll pass it as a 255, right padded with 0. This will make it easier to read from the socket as I know in advance that I need to read "sizeof(struct metadata)" bytes. |
|||
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
|