[zeromq-dev] Can we create client socket in server scope before send ack to client?

Doron Somech somdoron at gmail.com
Thu Oct 10 10:11:23 CEST 2019


It is a different sockets (sock2 and mSock), therefore the ack from C will
be received.

On Thu, Oct 10, 2019, 10:50 Tomasz Michalski <tmichalski23 at gmail.com> wrote:

> One correction:
>  //Send resp to machine B (not A)
>     mSock.send(msgAck)
> }
>
> czw., 10 paź 2019 o 09:45 Tomasz Michalski <tmichalski23 at gmail.com>
> napisał(a):
>
>> Hi
>> I have three machines. On each of them there is daemon app which perform
>> role as server REP and bind to  "tcp://*:5555". Moreover on each machine
>> one-shoot tool can be started by user in runtime which behaves as client -
>> create socket on port 5555,
>> connect("tcp://concreteIpAddressGivenByUserOnArgList::5555"), send msg,
>> destroy socket and exit.
>>
>> Here is the most complex case which come to my mind. Will it work?
>>
>> server on machine A:
>> {
>>     mSock.bind("tcp://*:5555");
>>     mSock.recv(msg)
>>
>>     //(Machine B sends to machine A msg)
>>     based on header I start concrete handler, in particular it may be
>> handler which send msg2 to machine C
>>     {
>>         //Machine A in server process scope sends to machine C msg2
>>         //create temporary client sock2:
>>         sock2.connect("tcp://anotherMachineIpAddr:5555");
>>         sock2.send(msg2);
>>         sock2.recv(msg2Ack); (*) -> please see below on machine C use case
>>         //destroy sock2
>>     }
>>
>>     //Send resp to machine A
>>     mSock.send(msgAck)
>> }
>>
>> Machine C:
>> server App: gets msg2 from machine A, process it
>> in the meantime someone starts tool which connect to machine A and send
>> msg3
>> server App: ack for msg2 is sent to machine A
>>
>> The question is what message will be received at machine A server at this
>> point (*). Will it be msg3 or ack for msg2?
>>
>> Another more complex case, what will happen if machine C will be machine
>> B?! Will here occur deadlock?
>>
>> Thanks in advance for response
>> BR
>> Tomek
>>
>>
>>
>> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20191010/019d9302/attachment.htm>


More information about the zeromq-dev mailing list