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

Tomasz Michalski tmichalski23 at gmail.com
Thu Oct 10 14:12:39 CEST 2019


of course I run process X only on one machine at the same time. But it
should work even if You run at the same time. But this simple case even not
work in machine A.

czw., 10 paź 2019 o 14:11 Tomasz Michalski <tmichalski23 at gmail.com>
napisał(a):

> I have problem that despite the code is the same on both machine A and B
> connect doesn't work from machine A and works from machine B.
> What might be the reason? I get errno: invalid argument:
>
> User starts proces X:
>         mSock.connect("tcp://192.168.101.3:5555); //this one doesn't work
> on 192.168.101.1
>         mSock.connect("tcp://192.168.101.1:5555); //this one works on
> 192.168.101.3
> On both machines proces daemon Y is running in background (server which
> binds to "tcp://*:5555). The intention is that User can communicate with
> server from machine A->B and B->A invoking various tools.
> This is very strange I cannot connect and "invalid argument" information
> is very useful:)
>
> czw., 10 paź 2019 o 10:13 Doron Somech <somdoron at gmail.com> napisał(a):
>
>> 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
>>>
>> _______________________________________________
>> 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/6d87f5f4/attachment.htm>


More information about the zeromq-dev mailing list