Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jivedingo

macrumors newbie
Original poster
Sep 6, 2008
4
0
I'm trying to do UDP networking in Java, and I've run into a problem running on of my programs on my mac.

I'm using port 67 and 68, and Java won't let me bind to them because they're already in use. I need to use them to run a simplistic BootP server to interface with some hardware. I'm guessing this is because DHCP uses these ports as well, but I don't really understand why they would still be bound by another process when my airport is turned off and I'm using ethernet with a static IP address. Is there any way I can find out and kill this process, or shut it down? Is there some kind of DHCP server built into mac that would use these ports?

Just to clarify, this works fine on my windows partition(bootcamp) under basically the same conditions.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I'm trying to do UDP networking in Java, and I've run into a problem running on of my programs on my mac.

I'm using port 67 and 68, and Java won't let me bind to them because they're already in use. I need to use them to run a simplistic BootP server to interface with some hardware. I'm guessing this is because DHCP uses these ports as well, but I don't really understand why they would still be bound by another process when my airport is turned off and I'm using ethernet with a static IP address. Is there any way I can find out and kill this process, or shut it down? Is there some kind of DHCP server built into mac that would use these ports?

Just to clarify, this works fine on my windows partition(bootcamp) under basically the same conditions.

The service name is called bootpc on my machine. You can run /usr/sbin/lsof to see if anything has that port open. Netstat might do the trick, too.

One other possible problem is that you're binding to ports below 1024, so you need to be running as root. Are you?

-Lee
 

jivedingo

macrumors newbie
Original poster
Sep 6, 2008
4
0
Nice, running as root did the trick - turns out there isn't a process using that port then...
Is there a way to make my program run under the root user straight out of an IDE? I just ran the jar file as root from the command line, but I need to be able to integrate this into a larger java project...
Thanks for your help
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Nice, running as root did the trick - turns out there isn't a process using that port then...
Is there a way to make my program run under the root user straight out of an IDE? I just ran the jar file as root from the command line, but I need to be able to integrate this into a larger java project...
Thanks for your help

Well, you could always use sudo to start your IDE. You'd have to do it from the terminal, but it should work. Anything the IDE starts should inherit its permissions. Note that anything your IDE does at that point is performed as root, though. This may not be an issue, but i'm not sure I'd trust my IDE with that. Maybe you could just bind to 1067 and 1068 while you're testing then adjust it when you're ready to "release" the code?

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.