예제 #1
0
Error
writeSocketIdToPipe(Pipe &port_pipe, const std::string &socket_id)
{
    size_t bytes_written = 0;
    // Write the port number as a C string with the NULL terminator.
    return port_pipe.Write(socket_id.c_str(), socket_id.size() + 1, bytes_written);
}
예제 #2
0
Error
WritePortToPipe(Pipe &port_pipe, const uint16_t port)
{
    char port_str[64];
    const auto port_str_len = ::snprintf(port_str, sizeof(port_str), "%u", port);

    size_t bytes_written = 0;
    // Write the port number as a C string with the NULL terminator.
    return port_pipe.Write(port_str, port_str_len + 1, bytes_written);
}
예제 #3
0
파일: pipe.cpp 프로젝트: Jackjet/vapula
void Pipe_Server()
{
	Pipe* pipe = new Pipe();
	pipe->Listen();
	pcstr id = pipe->GetPipeId();
	cout<<"id:"<<id<<endl;
	cout<<"[pause] <you can start another pipe as client>"<<endl;
	string input;
	cin>>input;
	cout<<"-------------"<<endl;
	for(;;)
	{
		cout<<"input:";
		cin>>input;
		if(input == "quit")
			break;
		pcstr data = str::Encode(input.c_str(), _vf_cp_oem, _vf_cp_msg);
		pipe->Write((raw)data, strlen(data) + 1);
	}
	pipe->Close();
}