DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 31st July 2015
mattthumper mattthumper is offline
Real Name: Matt Morrow
Port Guard
 
Join Date: Jul 2015
Location: Virginia, USA
Posts: 20
Question 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.
Reply With Quote
  #2   (View Single Post)  
Old 31st July 2015
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

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.
Reply With Quote
  #3   (View Single Post)  
Old 31st July 2015
mattthumper mattthumper is offline
Real Name: Matt Morrow
Port Guard
 
Join Date: Jul 2015
Location: Virginia, USA
Posts: 20
Default

Thanks. It should be working as designed. I'll continue to muck around.
Reply With Quote
  #4   (View Single Post)  
Old 31st July 2015
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

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.
Reply With Quote
  #5   (View Single Post)  
Old 31st July 2015
mattthumper mattthumper is offline
Real Name: Matt Morrow
Port Guard
 
Join Date: Jul 2015
Location: Virginia, USA
Posts: 20
Wink 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....
#######################################################################################
Those 6 parts denoted above are replaced with one line denoted below with "++++++++"
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....
#######################################################################################
So, I opened this reply with 'Bizarre'.
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 &
So the answer for me and maybe for some future Googler is to take the simple commands *out* of your .bashrc and stick those simple commands into a shell script.
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.
Reply With Quote
  #6   (View Single Post)  
Old 31st July 2015
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

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.
Reply With Quote
  #7   (View Single Post)  
Old 31st July 2015
mattthumper mattthumper is offline
Real Name: Matt Morrow
Port Guard
 
Join Date: Jul 2015
Location: Virginia, USA
Posts: 20
Default

Quote:
Originally Posted by ibara View Post
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.
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
And RE: "If you don't like OpenBSD, don't use it."

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.
Reply With Quote
  #8   (View Single Post)  
Old 31st July 2015
ibara ibara is offline
OpenBSD language porter
 
Join Date: Jan 2014
Posts: 783
Default

Quote:
Originally Posted by mattthumper View Post
> 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
I don't believe you. Something is wrong with your setup. Because it will just work if your environment is correct.

For future Googlers: Do not follow the advice from the previous post. Ask about how we can help you properly set up your environment.

Quote:
Originally Posted by mattthumper View Post
fa·ce·tious
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.
Reply With Quote
  #9   (View Single Post)  
Old 31st July 2015
mattthumper mattthumper is offline
Real Name: Matt Morrow
Port Guard
 
Join Date: Jul 2015
Location: Virginia, USA
Posts: 20
Default

Quote:
Originally Posted by ibara View Post
I don't believe you. Something is wrong with your setup. Because it will just work if your environment is correct.

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.
Yep.
You're right.
You're absolutely correct.
Reply With Quote
Old 1st August 2015
Oko's Avatar
Oko Oko is offline
Rc.conf Instructor
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 1,102
Default

Quote:
Originally Posted by mattthumper View Post
Yep.
You're right.
You're absolutely correct.
Yes he is absolutely right Let me reiterate one more time:

For future Googlers: Do not follow the advice from the user mattthumper. Ask about how we can help you properly set up your environment.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT. The time now is 08:22 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick