Write a client-server program in C ... on a piece of paper

It was an interview question. o_O

Leave aside the questions asking such a question in the interview.

I am wondering what alternatives to the TCP TCP socket approach are readily available (e.g. libraries) for use in C or C ++.

I do not make any assumptions on the platform, compiler, etc. - make a choice.

I do not ask you guys to write a program, but simply point out the technologies that can be used for this purpose, and, perhaps, with an example or a tutorial using this technology in C / C ++.

+3
source share
8 answers

I do not make any assumptions on the platform, compiler, etc. - make a choice.

main() {
   system("apache -start")

   system("telnet 127.0.0.1 80") 

}

; -)

+8

Berkeley sockets. , , , ( , , , / ..).

+7

tcpd, stdin/out . tcpd .: -)

+2

: CORBA

IDL → C mapper

A ++

+1

, , , . , "". , , . , , IPC , (.. , ?).

- : TCP/IP, , , - , . ,

// server
s = socket();
listen (s);
bind (s, addr_port);
while ((c = accept (s)) != -1)
    spawn_thread_or_proc (handle_connection, c);


// client
s = socket();
connect (s, addr_port); 
...

, . , , , , /, /proc, /, dns.

+1

DCOM

0

, Boost.ASIO - . ACE, , Berkeley .

0

Source: https://habr.com/ru/post/1753736/


All Articles