[zeromq-dev] Forcefully drop a peer connection
Mike Owens
mikeowens at gmail.com
Fri Jul 15 17:15:25 CEST 2011
It would be helpful if there were api functions that allow three basic
low-level socket operations:
1) A callback or hook of some kind that is called before accept(), which
includes basic peer info (remote ip) allowing the program the option of
refusing the incoming connection.
2) The ability to check whether connect() actually connected to the remote
host (valid tcp/ip connection), avoiding the need to have to send a ping and
infer from a timeout.
3) The ability to drop a connection. The remote side should be able to
detect this via some intterupt code (e.g. EDISCONNNECTED or something like
that).
Basically if peers can both refuse/drop connections and be able to detect
dropped or failed connections, it makes it easier for applications to handle
bad data or unwanted network connetions, making it much easier to use 0MQ
across public networks.
On Jul 14, 2011 11:51 PM, "Pieter Hintjens" <ph at imatix.com> wrote:
> On Fri, Jul 15, 2011 at 4:14 AM, Mike Owens <mikeowens at gmail.com> wrote:
>
>> I was testing sending random data to a ROUTER socket and ran into a
>> scenario I hadn't considered. What if the random data passed through
>> and is sent in to your socket for processing. Assuming your code can
>> detect this, and is able to tell at that point that the remote peer is
>> rogue, how can you (through the API) drop its connection? I have the
>> socket ID given by the ROUTER socket in the first message, but there
>> doesn't seem to be any way through the API to forcefully disconnect
>> that remote peer -- drop the connection. Or is there a way? Just
>> looking at the API reference, I can't seem to find anything that does
>> that.
>
> There is no way to do this with the current version of 0MQ. It's
> something we're planning to add.
>
> The best strategy today is to either ignore bad input, or reply with a
> challenge command (assuming your protocol uses a challenge/response
> security model).
>
> -Pieter
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110715/c7f848e2/attachment.htm>
More information about the zeromq-dev
mailing list