Reserving sockets

R

Roedy Green

Is there a mechanism either in Java or in Windows to reserve a socket?

Is there a mechanism to find out if a socket is in use by some other
program?

If you are a programmer, how do you go about deciding what socket to
use for some non-standard protocol?

Is this just something you expect the user to configure?

It turns out JetBrains IntelliJ Idea and something else that I have
not yet determined are fighting over the same sockets in the 6944
range.

PS. what is the best PCI Ethernet card, fast, rock solid drivers for
Vista and Ubuntu?
 
R

Roedy Green

Is there a mechanism to find out if a socket is in use by some other
program?

I found this tool for Windows:

REM find out who is using which TCP/IP sockets
netstat -o

rem you might get a result like this:
rem Proto Local Address Foreign Address State PID
rem TCP 192.168.0.101:49181 209.34.241.67:http ESTABLISHED
4908

Rem you can then get more information about what that PID means
TaskList /o

too see without wrap, see http://mindprod.com/jgloss/tcpip.html
 
R

RedGrittyBrick

Roedy said:
Is there a mechanism either in Java or in Windows to reserve a socket?

Without binding to it?
Is there a mechanism to find out if a socket is in use by some other
program?

You already know about netstat. Another tool is SysInternals TCPView.
The obvious way from Java is to attempt to bind to it.
If you are a programmer, how do you go about deciding what socket to
use for some non-standard protocol?

AIUI, a "socket" is the combination of a transport level protocol (e.g.
UDP or TCP), an IP-address and a port number. Therefore I'm assuming you
mean "how do I choose a TCP or UDP port number for my application?"

I'd read this, especially the first few paragraphs:
http://www.iana.org/assignments/port-numbers
It may also be interesting to grep it for "any private"?

If I was in a huge corporation planning a product I expected to become
very widely used (i.e. by millions of computers on the Internet) then I
suppose I'd try applying to IANA for a reserved port.

Is this just something you expect the user to configure?

I'd have a carefully chosen default but allow the user to configure it.
It turns out JetBrains IntelliJ Idea and something else that I have
not yet determined are fighting over the same sockets in the 6944
range.

IRC? Good luck!
PS. what is the best PCI Ethernet card, fast, rock solid drivers for
Vista and Ubuntu?

No idea, I'd pick a popular and well-known brand. E.g. Intel Gigabit.

I feel I have probably added nothing to your existing knowledge, sorry
about that :)
 
M

Martin Gregorie

Roedy said:
Is there a mechanism either in Java or in Windows to reserve a socket?
I look at my /etc/services file, but then I run Linux. There's a
regularly updated list of port numbers at

http://www.iana.org/assignments/port-numbers

This replaces RFC 1700, which formerly contained the definitive list.
Is there a mechanism to find out if a socket is in use by some other
program?
netstat

It is available for *NIX systems and NT-based Windows systems, so it
should be available from Win 2K onwards. Use the -n option to see port
numbers: otherwise it shows the service name. Use -p to see the program
name and PID.
If you are a programmer, how do you go about deciding what socket to
use for some non-standard protocol?
I've noticed that the low 16000s are unused and tend to use those in
sequence so my servers don't clash.
Is this just something you expect the user to configure?
I assign a default port but make the port number configurable, via a
configuration file, command line option or both. If both, the command
line option overrides the config file.

Many common programs, both open source and proprietary, are written with
a default and configurable override. This includes most database and web
servers. Its essential for these to have configurable ports because its
not uncommon to run multiple copies on a server. Their clients must also
use configurable port assignments.
It turns out JetBrains IntelliJ Idea and something else that I have
not yet determined are fighting over the same sockets in the 6944
range.
According to the IANA database 6944 is unassigned, so imagine my
surprise. I hope their port assignments are configurable.
PS. what is the best PCI Ethernet card, fast, rock solid drivers for
Vista and Ubuntu?
I used to swear by 3COM and at Linksys. My only, seldom used,
Windows/Linux dual boot box has still got a 10 year old 3COM 10mb card
in it which has never given trouble.

This laptop has a D-Link DFE-670TXB PCMCIA card and my house server has
a RealTek RTL8139 installed. The D-Link and Realtek are both dual speed
10/100 devices and both have been trouble free for 2-3 years. My LAN is
based on a D-Link hub which has 'just run' for about 8 years.
 
L

Lew

Martin said:
I used to swear by 3COM and at Linksys. My only, seldom used,
Windows/Linux dual boot box has still got a 10 year old 3COM 10mb card
in it which has never given trouble.

This laptop has a D-Link DFE-670TXB PCMCIA card and my house server has
a RealTek RTL8139 installed. The D-Link and Realtek are both dual speed
10/100 devices and both have been trouble free for 2-3 years. My LAN is
based on a D-Link hub which has 'just run' for about 8 years.

Realtek makes the motherboard-embedded NIC on my machine, an AMD-64-based
machine. No worries, but then, I'm dual-booting Fedora Core 7 and Win XP, not
the OSes of Roedy's concern.
 
M

Martin Gregorie

Lew said:
Realtek makes the motherboard-embedded NIC on my machine, an
AMD-64-based machine. No worries, but then, I'm dual-booting Fedora
Core 7 and Win XP, not the OSes of Roedy's concern.
My IBM Netvista (866 MHz, PIII) has a Realtek card in it which is
slightly surprising. I would have expected it to be on the motherboard.
It runs FC6 +J2SE 1.4 and will be upgraded to FC7 + JSE 6 when I get a
round tuit.
 
L

Lew

Martin said:
My IBM Netvista (866 MHz, PIII) has a Realtek card in it which is
slightly surprising. I would have expected it to be on the motherboard.
It runs FC6 +J2SE 1.4 and will be upgraded to FC7 + JSE 6 when I get a
round tuit.

I don't remember mobos with integrated NICs being very common, or even extant,
in P3 days. They started being more common only in the last couple or few years.
 
C

Christopher Benson-Manica

[comp.lang.java.programmer] Martin Gregorie said:
Roedy Green wrote:
It turns out JetBrains IntelliJ Idea and something else that I have
not yet determined are fighting over the same sockets in the 6944
range.

According to the IANA database 6944 is unassigned, so imagine my
surprise. I hope their port assignments are configurable.

According to the in-house IntelliJ guru, it's possible that IntelliJ
is using 6944 for its licensing enforcement, which might be why it
isn't documented anywhere. It also sounds like it's not configurable,
unfortunately.
 
C

Christopher Benson-Manica

[comp.lang.java.programmer] Roedy Green said:
Is there a mechanism either in Java or in Windows to reserve a socket?

ITYM "port".
Is this just something you expect the user to configure?

That's been my general strategy, but I don't write the type of
application where that might be a real concern.
It turns out JetBrains IntelliJ Idea and something else that I have
not yet determined are fighting over the same sockets in the 6944
range.

As a data point, Intellij 7 on this XP box seems not to be interested
in that port.
 
M

Martin Gregorie

Lew said:
I don't remember mobos with integrated NICs being very common, or even
extant, in P3 days. They started being more common only in the last
couple or few years.
Its an ATX mobo and had I assumed that integrated NICs came in with the
ATX format. Shows how long it is since I bought a new system: the last
new one I bought has a baby-AT board.
 
R

Roedy Green

No idea, I'd pick a popular and well-known brand. E.g. Intel Gigabit.

that's what I got. Intel has a feature that appeals, a common driver
for all its models. That strikes me then as more likely the card will
be supported for a long time to come and the driver will be bug-free.

Now to see if it clears up the weird TCP/IP locking problems.
 
R

Roedy Green

It turns out JetBrains IntelliJ Idea and something else that I have
not yet determined are fighting over the same sockets in the 6944
range.

I did a clean reinstall of Windows Vista and the problem has gone
away. An update install did not help.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top