Linux Alternative to Linux

We port existing Windows code to Linux. We use ACE as an abstraction layer. We use windows called pipe to communicate with multiple clients and to perform overlap operations.

Which is equivalent to this in linux. I checked linux named pipes (FIFO), but they seem to support only one client and server and do not support overlapping IOs.

Can you direct me to this.

+3
source share
3 answers

Unix sockets. Essentially

  • Challenge socket(PF_UNIX, SOCK_STREAM, 0). This returns a file descriptor or -1 on error.
  • To create a socket address, use struct sockaddr_un addr; bzero(addr); addr.sun_len = sizeof(addr); addr.sun_family = PF_UNIX; strncpy(addr.sun_path, "/path/to/file", sizeof(addr.sun_path)-1);.
  • Challenge bind(fd, &addr, sizeof(addr)).
  • listen(fd,backlog) . backlog - un-accept() ed, .
  • accept() . FD -1.
  • () ( , ).
  • /// ( , ).

, SOCK_DGRAM Unix ( , , UDP-).

man- (2), bind (2), listen (2), accept (2), connect (2), unix (4), setsockopt (2).

" -" . (2). IO fcntl(fd,F_SETFL,(int)(fcntl(fd,F_GETFL)|O_NONBLOCK)) (. Fcntl (2)), , read() write() ( , write() , ).

, Windows pipe , UNIX ( "" ).

+4

, fork() stdin/stdout / , . Python, IPC- , , * nix.

, , -, , , Windows. Windows, , , .

fork() IPC . , . , Hart tome Windows.

0

, unix TCP. Unix .

TCP.

Please note that some Windows functions with channel names are not supported - you cannot transfer credentials via a TCP socket, so you will need to design the protocol so that it does not require them.

0
source

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


All Articles