Hello,

I trying to have a ServerSocket bind to [::1]:8080 but I can't get it
working. I have OpenBSD 6.0-RELEASE and the JDK I use is jdk-1.8.0.72.

My code is pretty simple, I create a ServerSocket in this way:

... = new ServerSocket(8080, 0, Inet6Address.getByName("::1"));

But then I get the following exception:

java.net.SocketException: Protocol family unavailable

After many trials (I am new to OpenBSD :)), I managed to compile the
port using the with_ipv6 flavor. (I also used the native_bootstrap
flavor because I didn't manage to compile the port without it...)

The same code gives me a new error which is:

Exception in thread "main" java.net.SocketException: Invalid argument
at java.net.ServerSocket.createImpl(ServerSocket.java:307)

This was already discussed here but it offered no solution, see: "java
and IPv6: java.net.SocketException: Protocol family unavailable"

I've also tried with -Djava.net.preferIPv[4|6][Stack|Addresses] but to
no avail. There is no problem with my code as it works on other OSes
with different JDKs.

Any help would be greatly appreciated!
Nick

---

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 32768
index 3 priority 0 llprio 3
groups: lo
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
inet 127.0.0.1 netmask 0xff000000

nfe0: flags=208843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF6> mtu
1500
lladdr 00:23:df:a7:aa:20
index 1 priority 0 llprio 3
groups: egress
media: Ethernet autoselect (1000baseT full-duplex)
status: active
inet 192.168.0.101 netmask 0xffffff00 broadcast 192.168.0.255
inet6 fe80::223:dfff:fea7:aa20%nfe0 prefixlen 64 scopeid 0x1
inet6 [xyz] prefixlen 64 autoconf pltime 140548 vltime 745348
inet6 [zxy] prefixlen 64 autoconf autoconfprivacy pltime 34667
vltime 553146

OpenBSD 6.0 (GENERIC.MP) #2319: Tue Jul 26 13:00:43 MDT 2016
dera...@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/GENERIC.MP
RTC BIOS diagnostic error
fb<clock_battery,ROM_cksum,config_unit,memory_size,fixed_disk>
real mem = 4003491840 (3818MB)
avail mem = 3877683200 (3698MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xbfec6000 (43 entries)
bios0: vendor Apple Inc. version "MM31.88Z.0081.B06.0904271717" date
04/27/09
bios0: Apple Inc. Macmini3,1
acpi0 at bios0: rev 2
acpi0: sleep states S0 S3 S4 S5
acpi0: tables DSDT FACP HPET APIC MCFG ASF! SBST ECDT SSDT SSDT
acpi0: wakeup devices EC__(S3) OHC1(S3) EHC1(S3) OHC2(S3) EHC2(S3)
GIGE(S5)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpihpet0 at acpi0: 25000000 Hz
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Core(TM)2 Duo CPU P7350 @ 2.00GHz, 1592.23 MHz
cpu0:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,
CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,
VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,XSAVE,NXE,LONG,LAHF,PERF,SENSOR
cpu0: 3MB 64b/line 8-way L2 cache
cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 265MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2.2.2.1.3, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Core(TM)2 Duo CPU P7350 @ 2.00GHz, 1592.01 MHz
cpu1:
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,
CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,
VMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,SSE4.1,XSAVE,NXE,LONG,LAHF,PERF,SENSOR
cpu1: 3MB 64b/line 8-way L2 cache
cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 1 pa 0xfec00000, version 11, 24 pins
acpimcfg0 at acpi0 addr 0xf0000000, bus 0-255
acpiec0 at acpi0
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 2 (IXVE)
acpicpu0 at acpi0: !C3(100@57 mwait.3@0x31), !C2(500@1 mwait@0x10),
C1(1000@1 mwait), PSS
acpicpu1 at acpi0: !C3(100@57 mwait.3@0x31), !C2(500@1 mwait@0x10),
C1(1000@1 mwait), PSS
acpibtn0 at acpi0: PWRB
acpibtn1 at acpi0: SLPB
"APP0001" at acpi0 not configured
cpu0: Enhanced SpeedStep 1592 MHz: speeds: 1995, 1862, 1596 MHz
pci0 at mainbus0 bus 0
0:3:5: mem address conflict 0xd3400000/0x80000
pchb0 at pci0 dev 0 function 0 "NVIDIA MCP79 Host" rev 0xb1
"NVIDIA MCP79 Memory" rev 0xb1 at pci0 dev 0 function 1 not configured
pcib0 at pci0 dev 3 function 0 "NVIDIA MCP79 ISA" rev 0xb2
"NVIDIA MCP79 Memory" rev 0xb1 at pci0 dev 3 function 1 not configured
nviic0 at pci0 dev 3 function 2 "NVIDIA MCP79 SMBus" rev 0xb1
iic0 at nviic0
iic1 at nviic0
"NVIDIA MCP79 Memory" rev 0xb1 at pci0 dev 3 function 3 not configured
vendor "NVIDIA", unknown product 0x0a98 (class memory subclass RAM, rev
0xb1) at pci0 dev 3 function 4 not configured
"NVIDIA MCP79 Co-processor" rev 0xb1 at pci0 dev 3 function 5 not
configured
ohci0 at pci0 dev 4 function 0 "NVIDIA MCP79 USB" rev 0xb1: apic 1 int
17, version 1.0, legacy support
ehci0 at pci0 dev 4 function 1 "NVIDIA MCP79 USB" rev 0xb1: apic 1 int
22
usb0 at ehci0: USB revision 2.0
uhub0 at usb0 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
ohci1 at pci0 dev 6 function 0 "NVIDIA MCP79 USB" rev 0xb1: apic 1 int
18, version 1.0, legacy support
ehci1 at pci0 dev 6 function 1 "NVIDIA MCP79 USB" rev 0xb1: apic 1 int
23
usb1 at ehci1: USB revision 2.0
uhub1 at usb1 "NVIDIA EHCI root hub" rev 2.00/1.00 addr 1
azalia0 at pci0 dev 8 function 0 "NVIDIA MCP79 HD Audio" rev 0xb1: apic
1 int 20
azalia0: codecs: Realtek ALC885
audio0 at azalia0
ppb0 at pci0 dev 9 function 0 "NVIDIA MCP79 PCIE" rev 0xb1
pci1 at ppb0 bus 1
nfe0 at pci0 dev 10 function 0 "NVIDIA MCP79 LAN" rev 0xb1: apic 1 int
17, address 00:23:df:a7:aa:20
rgephy0 at nfe0 phy 1: RTL8169S/8110S/8211 PHY, rev. 2
ahci0 at pci0 dev 11 function 0 "NVIDIA MCP79 AHCI" rev 0xb1: msi, AHCI
1.2
ahci0: port 0: 3.0Gb/s
ahci0: port 1: 3.0Gb/s
scsibus1 at ahci0: 32 targets
sd0 at scsibus1 targ 0 lun 0: <ATA, Crucial_CT256M55, MU01> SCSI3
0/direct fixed naa.500a07510c0b822f
sd0: 244198MB, 512 bytes/sector, 500118192 sectors, thin
sd1 at scsibus1 targ 1 lun 0: <ATA, Hitachi HTS54505, PB4A> SCSI3
0/direct fixed naa.5000cca6adc6239e
sd1: 476940MB, 512 bytes/sector, 976773168 sectors
ppb1 at pci0 dev 16 function 0 "NVIDIA MCP79 PCIE" rev 0xb1
pci2 at ppb1 bus 2
"NVIDIA GeForce 9400" rev 0xb1 at pci2 dev 0 function 0 not configured
ppb2 at pci0 dev 21 function 0 "NVIDIA MCP79 PCIE" rev 0xb1: msi
pci3 at ppb2 bus 3
"Broadcom BCM4321" rev 0x05 at pci3 dev 0 function 0 not configured
ppb3 at pci0 dev 22 function 0 "NVIDIA MCP79 PCIE" rev 0xb1: msi
pci4 at ppb3 bus 4
"AT&T/Lucent FW643 1394" rev 0x07 at pci4 dev 0 function 0 not
configured
isa0 at pcib0
isadma0 at isa0
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
asmc0 at isa0 port 0x300/32: rev 1.35f535, 154 keys
usb2 at ohci0: USB revision 1.0
uhub2 at usb2 "NVIDIA OHCI root hub" rev 1.00/1.00 addr 1
usb3 at ohci1: USB revision 1.0
uhub3 at usb3 "NVIDIA OHCI root hub" rev 1.00/1.00 addr 1
efifb0 at mainbus0: 1920x1080, 32bpp
wsdisplay0 at efifb0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
nvram: invalid checksum
uhidev0 at uhub2 port 5 configuration 1 interface 0 "Apple Computer,
Inc. IR Receiver" rev 2.00/0.16 addr 2
uhidev0: iclass 3/0, 38 report ids
uhid0 at uhidev0 reportid 36: input=4, output=0, feature=0
uhid1 at uhidev0 reportid 37: input=4, output=0, feature=0
uhid2 at uhidev0 reportid 38: input=4, output=0, feature=0
uhub4 at uhub3 port 1 "Apple Inc. BRCM2046 Hub" rev 2.00/1.00 addr 2
ugen0 at uhub4 port 1 "Apple Inc. Bluetooth USB Host Controller" rev
2.00/2.08 addr 3
uhidev1 at uhub4 port 2 configuration 1 interface 0 "Apple Computer
product 0x820a" rev 2.00/1.00 addr 4
uhidev1: iclass 3/1, 1 report id
ukbd0 at uhidev1 reportid 1: 8 variable keys, 6 key codes
wskbd0 at ukbd0: console keyboard, using wsdisplay0
uhidev2 at uhub4 port 3 configuration 1 interface 0 "Apple Computer
product 0x820b" rev 2.00/1.00 addr 5
uhidev2: iclass 3/1, 2 report ids
ums0 at uhidev2 reportid 2: 3 buttons
wsmouse0 at ums0 mux 0
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on sd0a (c36d9b190d4a3af1.a) swap on sd0b dump on sd0b
clock: unknown CMOS layout

Reply via email to