[zeromq-dev] Requesting suggestions for getsockopt() in Java
Matt Weinstein
matt_weinstein at yahoo.com
Mon Aug 9 17:15:22 CEST 2010
isn't this where Hungarian notation is useful ? :-)
void setIntSocketOpt(int optID, int)
void setByteSetSocketOpt(int optID, byte[])
...
awful, but typesafe :-(
On Aug 9, 2010, at 10:51 AM, Steven McCoy 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
>
> --
> Steve-o
> _______________________________________________
> 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/20100809/3287818e/attachment.htm>
More information about the zeromq-dev
mailing list