On Mon, 2013-02-04 at 14:39 +1300, Vince Stewart wrote: > Using Tomcat 7.0.35 embedded in Java standalone application. Java SE 1.7.0. > Ubuntu 12.04 > > Hi All, > > I have an experimental class below. The aim is just to open a listening > port on port 4000 in the "localhost" address. > When this has run, the address for the listener is "127.0.0.1" in other > words an IPv4 address. > However the SocksSocketImpl object representing the real socket continues > to display the* useV4* property as *false* > and my Ubuntu system displays the listening socket as "tpc6". > Listening only for tcp6? What does netstat -atn | grep -P ":4000\W" show?
Perhaps what you want is to set the java.net.preferIPv4Stack system property in CATALINA_OPTS? Description here: http://docs.oracle.com/javase/7/docs/technotes/guides/net/properties.html But why would you want that limitation? > I suspect there is some configuration issue somewhere and if anyone can > help with this, I would be most grateful. > > I have also noted that the java.nio.channels.spi.SelectorProvider cannot > return a Provider from loadProviderFromProperty() or loadProviderAsService() > so therefore issues *provider = > sun.nio.ch.DefaultSelectorProvider.create()*resulting in a > ServerSocketChannel that is of type > *sun.nio.ch.ServerSocketChannelImpl* > and a ServerSocket of type *sun.nio.ch.ServerSocketAdapter*. I'm not sure > that these are intended and may be I need a system property named > "java.nio.channels.spi.SelectorProvider" to ensure some other > SelectorProvider and therefore different ServerSocketChannel and > ServerSocket types. > > public class TribalAfiliations{ > Channel myChannel; > private static class MyMemberListener implements MembershipListener{...} > private static class MyMessageListener implements ChannelListener{...} > > TribalAfiliations() throws SocketException{ > this.myChannel=new GroupChannel(); > ChannelListener msgListener = new TribalAfiliations.MyMessageListener(); > MembershipListener mbrListener = new TribalAfiliations.MyMemberListener(); > myChannel.addMembershipListener(mbrListener); > myChannel.addChannelListener(msgListener); > try{ > > myChannel.start(Channel.MBR_TX_SEQ|Channel.MBR_RX_SEQ|Channel.SND_TX_SEQ|Channel.SND_RX_SEQ); > /// same problem, with myChannel.start(Channel.DEFAULT); > } > catch(ChannelException e){ > System.out.println(e.getMessage()); > } > } > > > > > >
signature.asc
Description: This is a digitally signed message part