public void WrongOrderRepReq() { Socket rep0; var errno = Protocols.Rep0(out rep0); Assert.IsTrue(errno == 0); Socket req0; errno = Protocols.Req0(out req0); Assert.IsTrue(errno == 0); Dialer dialer; errno = Dialer.Dial(req0, "ipc:///myFirstPipe1234", out dialer, Flag.nonblock); // Assert.IsTrue(errno == 0); System.Threading.Thread.Sleep(100); Listener listener; errno = Listener.Listen(rep0, "ipc:///myFirstPipe1234", out listener, 0); Assert.IsTrue(errno == 0); errno = req0.Send(new byte[] { 1, 2, 3, 4 }, Flag.none); Assert.IsTrue(errno == 0); byte[] data; byte[] data2; rep0.Receive(out data, 0); Assert.IsTrue(data.SequenceEqual(new byte[] { 1, 2, 3, 4 })); rep0.Send(data); req0.Receive(out data2, 0); Assert.IsTrue(data.SequenceEqual(new byte[] { 1, 2, 3, 4 })); Assert.IsTrue(req0.Close() == 0); Assert.IsTrue(rep0.Close() == 0); }
public void TrivialRepReq() { Socket rep0; var errno = Protocols.Rep0(out rep0); Assert.IsTrue(errno == 0); Socket req0; errno = Protocols.Req0(out req0); Assert.IsTrue(errno == 0); Listener listener; errno = Listener.Listen(rep0, "ipc:///myFirstPipe1234", out listener, 0); Assert.IsTrue(errno == 0); Dialer dialer; errno = Dialer.Dial(req0, "ipc:///myFirstPipe1234", out dialer, 0); Assert.IsTrue(errno == 0); req0.Send(new byte[] { 1, 2, 3, 4 }, 0); byte[] data; byte[] data2; rep0.Receive(out data, 0); Assert.IsTrue(data.SequenceEqual(new byte[] { 1, 2, 3, 4 })); rep0.Send(data); req0.Receive(out data2, 0); Assert.IsTrue(data.SequenceEqual(new byte[] { 1, 2, 3, 4 })); Assert.IsTrue(req0.Close() == 0); Assert.IsTrue(rep0.Close() == 0); }
void RPCClientStart() { Errno errno; errno = Protocols.Req0(out req0); Assert.IsTrue(errno == Errno.ok); errno = req0.SetOptInt("raw", 1); Assert.IsTrue(errno == Errno.ok); errno = Dialer.Dial(req0, "ipc:///myfirstpipe12345", out dialer, 0); Assert.IsTrue(errno == Errno.ok); errno = Aio.Alloc(out clientAio, RPCClientCallback, null); Assert.IsTrue(errno == Errno.ok); req0.Receive(clientAio); }
public void ServerDeathRepReq() { Socket rep0; var errno = Protocols.Rep0(out rep0); Assert.IsTrue(errno == 0); Socket req0; errno = Protocols.Req0(out req0); Assert.IsTrue(errno == 0); Listener listener; errno = Listener.Listen(rep0, "ipc:///myFirstPipe1234", out listener, 0); Assert.IsTrue(errno == 0); Dialer dialer; errno = Dialer.Dial(req0, "ipc:///myFirstPipe1234", out dialer, 0); Assert.IsTrue(errno == 0); req0.Send(new byte[] { 1, 2, 3, 4 }, 0); byte[] data; byte[] data2; rep0.Receive(out data, 0); Assert.IsTrue(data.SequenceEqual(new byte[] { 1, 2, 3, 4 })); rep0.Close(); // that's unexpected. System.Threading.Thread.Sleep(500); // server restart errno = Protocols.Rep0(out rep0); Assert.IsTrue(errno == 0); errno = Listener.Listen(rep0, "ipc:///myFirstPipe1234", out listener, 0); Assert.IsTrue(errno == 0); errno = rep0.Receive(out data, 0); Assert.IsTrue(errno == 0); errno = rep0.Send(data); Assert.IsTrue(errno == 0); errno = req0.Receive(out data2, 0); Assert.IsTrue(errno == 0); Assert.IsTrue(data.SequenceEqual(new byte[] { 1, 2, 3, 4 })); Assert.IsTrue(req0.Close() == 0); Assert.IsTrue(rep0.Close() == 0); }