In my scenario, a client and a server establish a connection and exchange their Process ID's and a shared-memory-location ID. After this process has completed the server ends the connection and waits for a signal. When the Client writes some information into the shared-memory, it sends a signal to the server which then goes to the memory location and prints the date.
在我的场景中,客户端和服务器建立连接并交换其进程ID和共享内存位置ID。此过程完成后,服务器结束连接并等待信号。当客户端将一些信息写入共享内存时,它会向服务器发送一个信号,然后该信号进入内存位置并打印日期。
How should i go about this please help!!!
我该怎么办呢,请帮忙!!!
1 个解决方案
#1
1
You could just use a socket for all your communication.
您可以使用套接字进行所有通信。
Sockets have a useful feature called half-open connection. That is, one side can finish sending data and send end-of-file to the other side using shutdown(socket, SHUT_WR)
, but still wait for incoming data. The other side can keep reading data till receiving the end-of-file, send data and eventually also do shutdown(socket, SHUT_WR)
or close(socket)
.
套接字有一个称为半开连接的有用功能。也就是说,一方可以使用shutdown(套接字,SHUT_WR)完成发送数据并将文件结束发送到另一方,但仍然等待传入数据。另一方可以继续读取数据,直到收到文件结束,发送数据,最后还关闭(套接字,SHUT_WR)或关闭(套接字)。
#1
1
You could just use a socket for all your communication.
您可以使用套接字进行所有通信。
Sockets have a useful feature called half-open connection. That is, one side can finish sending data and send end-of-file to the other side using shutdown(socket, SHUT_WR)
, but still wait for incoming data. The other side can keep reading data till receiving the end-of-file, send data and eventually also do shutdown(socket, SHUT_WR)
or close(socket)
.
套接字有一个称为半开连接的有用功能。也就是说,一方可以使用shutdown(套接字,SHUT_WR)完成发送数据并将文件结束发送到另一方,但仍然等待传入数据。另一方可以继续读取数据,直到收到文件结束,发送数据,最后还关闭(套接字,SHUT_WR)或关闭(套接字)。