I'm a little new to C, but I did my homework (some tutorials, books, etc.) and I need to program a simple server to handle requests from clients and interact with db. I went through the Beej Guide for network programming, but I'm a little unsure how to compose and process the different parts of the data sent back and forth.
For example, let's say a client sends some information that the server will put in several fields. How to combine this data for sending, and then split it on the server side?
Thanks,
Eric
, : " , ?"
, , : , . , .
, , - , , "", "" "" " ", , .
, , . , , , ..
struct Person { char* name; int age; int heightInInches; // ... other fields ... };
/. :
, , /, .
, . , , , send/recv?
, - . , . , , , , , big-endian little-endian, 32- long 64- long, , , , - , .
long
, ( ) ( " " ) .
, , , .
, ntohs() ('n') ('h') "" ( 16-) htonl() host 'long' (32- ) - ..
ntohs()
htonl()
- " UNIX, 1, Edn". -, .
, . , , - xmls .
. , , , . .
The biggest advantage is that after you have the parser on the client side, even if you need to send some new information, they just need to agree on the tag name, which will be analyzed on the client side.
It helps me, I hope it helps too.
Source: https://habr.com/ru/post/1710839/More articles:Missing master pages in Project Web Deployment - asp.net-mvcProxyFactoryFactoryNotConfiguredException, ะฐ lazy - false - nhibernateMod ReWrite Catch-All Subdomain - .htaccessLiquid plugin - ruby-on-railsIs sitemap.axd supported by all search engines? - seoHow do you write tr: nth-child (odd) in Sass? - ruby-on-railsIE7: How to make TD float? - cssRemoving svn checkout with NAnt - svnProblem with Url.Content in ASP.NET MVC - asp.netWhy does UPPER () not work in MySQL? - mysqlAll Articles