[zeromq-dev] Requesting suggestions for getsockopt() in Java
Martin Sustrik
sustrik at 250bpm.com
Mon Aug 9 16:42:04 CEST 2010
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?
Martin
More information about the zeromq-dev
mailing list