[zeromq-dev] Requesting suggestions for getsockopt() in Java

Steven McCoy steven.mccoy at miru.hk
Mon Aug 9 17:23:16 CEST 2010


On 9 August 2010 22:51, Steven McCoy <steven.mccoy at miru.hk> wrote:

> On 9 August 2010 22:42, Martin Sustrik <sustrik at 250bpm.com> wrote:
>
>> gonzalo diethelm wrote:
>> >>> As always, just copy Sun's original implementation, implement
>> > getters
>> >>> and setters for every socket option:
>> >> +1
>> >
>> > Ok, but I seem to remember there was a point made about not adding
>> > separate interfaces for each socket option; this way, when new options
>> > are added, old code can be made aware of them without changes (or
>> > something to that effect). Perhaps this only applied to C code.
>> >
>> > So, if we go the full Java way, we would end up with the following
>> > methods:
>> >
>> >   void setSocketHWM(int hwm);
>> >   void setSocketSwap(int swap);
>> >   void setSocketAffinity(int affinity);
>> >   void setSocketIdentity(byte[] identity);
>> >   void setSocketSubscribe(byte[] subscribe);
>> >   void setSocketUnsubscribe(byte[] unsubscribe);
>> >   void setSocketRate(int rate);
>> >   void setSocketRecoveryInterval(int recovery_interval);
>> >   void setSocketMulticastLoop(boolean multicast_loop);
>> >   void setSocketSendBufferSize(int sndbuf);
>> >   void setSocketReceiveBufferSize(int rcvbuf);
>> >   void setSocketReceiveMore(boolean rcvmore);
>> >
>> >   int getSocketHWM();
>> >   int getSocketSwap();
>> >   int getSocketAffinity();
>> >   byte[] getSocketIdentity();
>> >   byte[] getSocketSubscribe();
>> >   byte[] getSocketUnsubscribe();
>> >   int getSocketRate();
>> >   int getSocketRecoveryInterval();
>> >   boolean getSocketMulticastLoop();
>> >   int getSocketSendBufferSize();
>> >   int getSocketReceiveBufferSize();
>> >   boolean getSocketReceiveMore();
>> >
>> > Thoughts?
>>
>> What I saw on the page referenced by Steve looked like this:
>>
>>        void setOption(int optID, Object val) throws SocketException;
>>        Object getOption(int optID) throws SocketException;
>>
>> Isn't that sandard Java sockopt interface?
>>
>>
> Perversely they are doing both, I read the article as that they have now
> introduced the type-safe API in 1.4.  I don't see the Object API listed in
> the documentation, so I presume it's now only the internal API,
>
> http://download-llnw.oracle.com/javase/1.4.2/docs/api/java/net/Socket.html
> http://download.oracle.com/javase/1.4.2/docs/api/java/net/ServerSocket.html
>
>
Ok the socket options are hiding as inherited items,

http://download.oracle.com/javase/1.5.0/docs/api/java/net/SocketOptions.html


So does that mean both should be implemented for ZeroMQ?

-- 
Steve-o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100809/6573b4f9/attachment.htm>


More information about the zeromq-dev mailing list