|
OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD. |
|
Thread Tools | Display Modes |
|
|||
Client/Server, Java, OpenBSD and Communication Ports
All,
How do I find out what ports are available for me to use on my (Dell) OpenBSD desktop system? Background - ------------- I have used a very simple Java client/server program for years and years. It's a simple reminder/scheduler program that works just like 'at' called 'mat' which stands for '(m)y at'. I wrote it while on a project where regular users (like me) were not permitted to use 'at', only the system administators could use 'at'. We were, however, allowed to write and execute our own Java programs, so I wrote my own 'at'. Nowadays I use it almost exclusively as an hourly reminder that uses the host system's echo command (echo on Unix and Linux, 'cmd.exe /c echo' on Windoze). It also plays an audio alert to get your attention (BEEP-BEEP from the old Roadrunner cartoon) and then echo's your reminder to stdout. Here's some further information - ----------------------------------- The client threads communicate with the server using a port that I specify in an .init file. I've used 'PORT 45654' on both Windows 7, Windows NT and Linux boxes. Years ago I just selected it from those ports that are typically available (regardless of OS). As a matter of fact, I've used that exact same port on this same Dell desktop when I was running Fedora on it. Java information, and the problem - ----------------------------------- The program executes and displays no errors. The reminders just never appear in the output window, and the audio alert never sounds either. My Java program uses in the server: serverSocket = new ServerSocket(PORTNUM.intValue()); and the client uses: socket = new Socket(address, PORTNUM.intValue()); ( Where address isn't needed - it's just "address=new String();" ) So, how do I allow simple client/server communication through a port in OpenBSD? TIA, Matt Last edited by mattthumper; 31st July 2015 at 04:42 PM. |
|
|||
All 65535 ports are open to you, in theory.
In practice, depending on circumstances, you will have fewer. On a LAN, you can probably use them all. What is exposed to the Internet at large comes down to what your ISP allows, so you'll have to check with them. Mine, for example, prevents external usage of 80. So while I can use it on my LAN, I cannot host a public website on that port. Reserved ports are 0-1023. Above that, all are free for any use. |
|
|||
Thanks. It should be working as designed. I'll continue to muck around.
|
|
||||
The network stack diagnostic tool tcpdump(8) may be helpful to you.
I know you prefer graphical tools, so I will mention that net/wireshark is available. You may already know what follows. But just in case you are not familiar with the security issues the application has.... The best practice is to never run wireshark on any production platform, be it a server or workstation. Many users of it find it more convenient to run it in a disposable virtual machine than from a workstation dedicated solely as a wireshark platform. Wireshark can be used more safely if it is run against traffic captured separately with tcpdump. See the README in /usr/local/share/doc/pkg-readmes if you install the package, or read the source to the README directly from the CVS repository here. |
|
|||
Resloved. Nothing to do with ports.
Bizarre.
It's simply the way I call it from my .bashrc. It has nothing to do with ports. I built in the capability where it's still client/server but instead of a port they communicate by reading an ascii-text flat-file (in case that was disallowed). That file monitoring method also did not work. The Java programs were correctly submitted and executing, it's just that the output was not displayed in the calling/parent terminal's stdio. That output was simply either: /bin/echo output or java audio output ( Applet.newAudioClip(URL); ) = and that output was not ever received in stdout. Here's the information that *might* come in handy for someone else - I have a once-per-day routine that is executed in my .bashrc. Again, a tried and true system that's worked in my .bashrc, .cshrc, .profile; in Linux, Cygwin, MKS, even Windoze-Startup-.bat fer cryin' out loud. The 6 parts denoted with '>>>>>>>>" of that once-per-day routine do not correcly/fully work in OpenBSD. Code:
####################################################################################### # Section for once-a-day login activities # last_login="/home/bubba/Software/Java/Projects/mat_Project/.login_last" current_login="/home/bubba/Software/Java/Projects/mat_Project/.login_current" currentdir=`pwd`; # create the last_login file if it doesn't exist test -r $last_login if [ $? -eq 1 ] then # Create it or reinitialize it echo "junk" > $last_login fi date +%y%m%d > $current_login cmp -s $last_login $current_login if [ $? -eq 1 ] then xclock -d -twentyfour -update 15 & sleep 1 cd /home/bubba/Software/Java/Projects/mat_Project echo " " >>>>>>>> java mat_server & sleep 8 >>>>>>>> java mat -d AUTO & sleep 8 >>>>>>>> java mat -w AUTO & sleep 8 >>>>>>>> java mat -m AUTO & sleep 8 >>>>>>>> java mat -iam AUTO & sleep 8 >>>>>>>> java mat_GUI & cd /home/bubba /home/bubba/Software/Scripts/launch_Launcher.sh & # Now put in today's date date +%y%m%d > $last_login & fi rm -f $current_login > /tmp/null 2> /tmp/null & sleep 1 cd $currentdir; # # End of once-a-day.... ####################################################################################### Code:
####################################################################################### # Section for once-a-day login activities # last_login="/home/bubba/Software/Java/Projects/mat_Project/.login_last" current_login="/home/bubba/Software/Java/Projects/mat_Project/.login_current" currentdir=`pwd`; # create the last_login file if it doesn't exist test -r $last_login if [ $? -eq 1 ] then # Create it or reinitialize it echo "junk" > $last_login fi date +%y%m%d > $current_login cmp -s $last_login $current_login if [ $? -eq 1 ] then xclock -d -twentyfour -update 15 & sleep 1 ++++++++ ++++++++ /usr/X11R6/bin/xterm -e /home/bubba/Software/Scripts/mat.sh -hold -title "mat" & ++++++++ cd /home/bubba /home/bubba/Software/Scripts/launch_Launcher.sh & # Now put in today's date date +%y%m%d > $last_login & fi rm -f $current_login > /tmp/null 2> /tmp/null & sleep 1 cd $currentdir; # # End of once-a-day.... ####################################################################################### Here's why - Here's my mat.sh - Code:
# cd /home/bubba/Software/Java/Projects/mat_Project echo " " /usr/local/jdk-1.7.0/bin/java mat_server & sleep 8 /usr/local/jdk-1.7.0/bin/java mat -d AUTO & sleep 8 /usr/local/jdk-1.7.0/bin/java mat -w AUTO & sleep 8 /usr/local/jdk-1.7.0/bin/java mat -m AUTO & sleep 8 /usr/local/jdk-1.7.0/bin/java mat -iam AUTO & sleep 8 /usr/local/jdk-1.7.0/bin/java mat_GUI & Then call *that* from your .bashrc - using /usr/X11R6/bin/xterm, the -e option, the -hold option, and optionally the -title option - AND PLACE THAT IN THE BACKGROUND. Simple, right? Gosh, I just love OpenBSD. Last edited by ocicat; 1st August 2015 at 02:22 AM. Reason: Please use [code] & [/code] tags when posting console output. |
|
|||
Or, you put /usr/local/jdk-1.7.0/bin in your PATH.
Just a suggestion... If you don't like OpenBSD, don't use it. No one will take it personally. |
|
|||
Quote:
Code:
> echo $PATH /usr/X11R6/bin:/usr/local/jdk-1.7.0/bin:/usr/local/bin:/bin:/sbin:/usr/bin:.:/home/matthew/Software/Scripts:/home/matthew/bin:/usr/share/ant/bin fa·ce·tious fəˈsēSHəs/ adjective adjective: facetious treating serious issues with deliberately inappropriate humor; flippant. synonyms: flippant, flip, glib, frivolous, tongue-in-cheek, ironic, sardonic, joking, jokey, jocular, playful, sportive, teasing, mischievous; More witty, amusing, funny, droll, comic, comical, lighthearted, jocose "unfortunately, they took my facetious remarks seriously" antonyms: serious Origin late 16th century (in the general sense ‘witty, amusing’): from French facétieux, from facétie, from Latin facetia ‘jest,’ from facetus ‘witty.’ ;-) ;-) ;-) Don't feel like you have to reply. I won't mind. Drink less coffee. Take yourself less seriously. ;-) ;-) ;-) Last edited by ocicat; 1st August 2015 at 02:23 AM. Reason: Please use [code] & [/code] tags when posting console output. |
|
|||
Quote:
For future Googlers: Do not follow the advice from the previous post. Ask about how we can help you properly set up your environment. I was completely serious. You'll know when I'm being facetious. You're free to continue using OpenBSD, but being disparaging over what is certainly something you did wrong is not likely to win you help. |
|
|||
Quote:
You're right. You're absolutely correct. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Openbsd 4.9 ftp as a client | mikygee | OpenBSD Security | 8 | 25th December 2011 04:08 PM |
OBSD client hangs mounting NFS; Linux client doesn't | amorphousone | OpenBSD General | 7 | 26th August 2010 05:21 AM |
Server-Client | c0mrade | Programming | 3 | 18th March 2009 05:22 PM |
Sun Java System Web Server - Active Server Pages (yes ASP) | hopla | FreeBSD General | 0 | 26th September 2008 08:22 AM |
rsync freebsd server/windows client | Weaseal | FreeBSD General | 0 | 27th August 2008 12:29 AM |