LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   How to connect a java client to a BSD server using socket programming (https://www.linuxquestions.org/questions/programming-9/how-to-connect-a-java-client-to-a-bsd-server-using-socket-programming-895689/)

sanju.lnt 08-05-2011 03:55 AM

How to connect a java client to a BSD server using socket programming
 
Hi, Can any one help me to connect a java client to a BSD server using socket programming ( Loop Back )?

Is it is possible communicate between java process and linux process using MSGq's or Shared memory.

Proud 08-06-2011 02:44 PM

Quote:

a BSD server
What service/process on this server do you wish to connect to? What have you tried so far, and why hasn't it worked? I've not known sockets to care about the difference between OSs involved on client and server.

Message Queues as in MQ/JMS? Sure, why not, just like both ends talking to any other persistance layer like a SQL RDBMS or a filesystem.
Java and shared memory, don't think so due to the JRE/VM. Probably going to need JNI/an Extension, or consider IDL/CORBA (can't use RMI if both ends aren't Java unless I'm mistaken).

paulsm4 08-06-2011 02:57 PM

Hi -
Quote:

Can any one help me to connect a java client to a BSD server using socket programming
No sweat :)! Sockets are sockets. Look up any "Hello world" tutorial on Java sockets programming, and you've got it.

Quote:

Is it is possible communicate between java process and linux process using MSGq's or Shared memory?
Short answer - no.

Longer answer - you might be able to find libraries or 3rd party products to allow Java programs to participate in SysV IPCs (e.g. SysV shared memory, message queues and semaphores). Or you can try writing your own (in JNI). But I wouldn't encourage it.

BTW, if you're not familiar with SysV IPCs, I strongly encourage you to check out Beej's Guide:

http://beej.us/guide/bgipc/output/ht...age/bgipc.html


All times are GMT -5. The time now is 03:14 PM.