我有两个可执行文件:client.exe和server.exe.
它们通过使用命名管道相互通信.当服务器仅侦听客户端请求并向客户端发送响应时,它们可以正常工作.
但现在要求是exes包含客户端管道和服务器管道.所以每个exe包含两个方法:serverpipe()和clientpipe().这些方法在一个线程中,不相互通信.
第一个客户端和服务器正常通信
Client.EXE:
public static void Main(string[] Args)
{
PipeClient obj=new PipeClient();
obj.client();
Thread startserver = new Thread(new ThreadStart(obj.server));
startserver.Start();
}
public void client()
{
int cnt =0;
while (true)
{
System.IO.Pipes.NamedPipeClientStream pipeClient = new System.IO.Pipes.NamedPipeClientStream(".", "\\\\.\\pipe\\SamplePipe1", System.IO.Pipes.PipeDirection.InOut, System.IO.Pipes.PipeOptions.None);
if (pipeClient.IsConnected != true) { pipeClient.Connect(); }
StreamReader sr = new StreamReader(pipeClient);
StreamWriter sw = new StreamWriter(pipeClient);
string temp;
temp = sr.ReadLine();
if (temp == "Waiting")
{
try
{ …Run Code Online (Sandbox Code Playgroud) 我已经在c#和vb.net中编写了代码,但现在要求是vb6.Can我将vb.net代码转换为vb6.如何在vb6中添加命名空间System.Security.Cryptography