Connector_RAW for server sharing
This commit is contained in:
parent
2274a05b9c
commit
309f727f62
4 changed files with 61 additions and 0 deletions
26
Connector_RAW/main.cpp
Normal file
26
Connector_RAW/main.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <iostream>
|
||||
#include "../sockets/SocketW.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int main() {
|
||||
SWUnixSocket mySocket;
|
||||
std::string input;
|
||||
std::cin >> input;
|
||||
input = "/tmp/shared_socket_"+input;
|
||||
mySocket.connect(input);
|
||||
char buffer[500000];
|
||||
int msg;
|
||||
while(true) {
|
||||
msg = mySocket.recv(&buffer[0],10000);
|
||||
if (!std::cout.good()) {exit(0);}
|
||||
std::cout.write(buffer,msg);
|
||||
}
|
||||
// disconnect
|
||||
mySocket.disconnect();
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue