wood burning stoves 2.0*
The moose likes Sockets and Internet Protocols and the fly likes sockets and comm package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "sockets and comm package " Watch "sockets and comm package " New topic
Author

sockets and comm package

supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
Hello
i want to access serial port of a pc connected in network.. that is i want to access the com port of other pc in a network.... can i combine comm package and sockets for this? or if you can suggest some better technology to be used..... is there any facility in sockets where i can specify the com port like COM 3 because i do not know whether this is permitted in sockets....
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
Sockets are for TCP/IP traffic; you can't use them for serial communication.

The http://faq.javaranch.com/java/JavaIoFaq page points to several APIs you can use for this; search for "javax.comm".


Ping & DNS - my free Android networking tools app
supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
thanks... but how to do it using com package??? we have done com port identification and access the data on the port (read,write) on a standalone pc now we want to do it in a network....
how to do it... that is identify it acces it ??? i.e com port of other pc on a network...

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
What do you mean by "com package"? Some software you're using already?

COM ports are used for serial communication; when you say "network", I'm assuming that's not something set up to run over serial ports, but a standard TCP/IP network. So that wouldn't help with accessing COM ports.
supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
Ulf Dittmer wrote:What do you mean by "com package"? Some software you're using already?

COM ports are used for serial communication; when you say "network", I'm assuming that's not something set up to run over serial ports, but a standard TCP/IP network. So that wouldn't help with accessing COM ports.


hello
com package means comm package for communication in java..No set up....Imagine a software company where pen drives are not allowed and if someody insrts a pen drive then i should be able to detect/access it using my machine. Like read/write data from the pendrive.Is it possible wid comm package or sockets??
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
Imagine a software company where pen drives are not allowed and if someody insrts a pen drive then i should be able to detect/access it using my machine. Like read/write data from the pendrive.Is it possible wid comm package or sockets??

Those devices use USB, not serial or socket communication. If you're asking whether you can detect if someone attaches a USB device on a remote machine, simply by running code on your local machine, then the answer is no. There'd at least need to be a daemon process running on each machine that detects such a thing, and which then can take appropriate action. That's not something that Java lends itself to easily, though; consider native code instead.
supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
Ulf Dittmer wrote:
Imagine a software company where pen drives are not allowed and if someody insrts a pen drive then i should be able to detect/access it using my machine. Like read/write data from the pendrive.Is it possible wid comm package or sockets??

Those devices use USB, not serial or socket communication. If you're asking whether you can detect if someone attaches a USB device on a remote machine, simply by running code on your local machine, then the answer is no. There'd at least need to be a daemon process running on each machine that detects such a thing, and which then can take appropriate action. That's not something that Java lends itself to easily, though; consider native code instead.

thanks
i want to access the com port of he computer next o me??? how do i do it then??? wat technology do you suggest?
i thouht i could do i using sockets,comm pkg but now its not possible.....
then could you suggest something..... for this......
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
The COM port of a remote machine can be accessed through a serial connection from your local COM port. But the days when computers were networked using serial connections are long gone. What is it that you're trying to achieve?
supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
Ulf Dittmer wrote:The COM port of a remote machine can be accessed through a serial connection from your local COM port. But the days when computers were networked using serial connections are long gone. What is it that you're trying to achieve?



ok..i want that only...I want to access data from a mobile which is attached to com port(read.write on that port)..tell me how can i do that???
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41132
    
  45
The Java I/O FAQ I linked to mentions several Java libraries that can be used to communicate over a serial port. Consult the documentation of the device for the details of that communication.
supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
thnx
supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
but how can we access other pc's com port,,,i have done wid single pc but how to do it in a network ie another pc..is there any method for that?
Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
You want to access a com port of another computer on a network?

If they are both on a LAN, just use sockets for communication, much simpler. Otherwise you need connect com ports and use the library already mentioned.

Are you trying to do this to share files? If so, why not set up network folders via samba or whatever it is called that Windows uses for this purpose.

For the USB problem, shut off USB in the BIOS and password protect it.


"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
supriya acharya
Greenhorn

Joined: Jan 26, 2009
Posts: 28
Rusty Shackleford wrote:You want to access a com port of another computer on a network?

If they are both on a LAN, just use sockets for communication, much simpler. Otherwise you need connect com ports and use the library already mentioned.

Are you trying to do this to share files? If so, why not set up network folders via samba or whatever it is called that Windows uses for this purpose.

For the USB problem, shut off USB in the BIOS and password protect it.



Thanks
in the earlier conversation we were old that sockets cannot detect COM ports..... so we do no know the exact technology with which we can access the usb on the other machine......
 
Consider Paul's rocket mass heater.
 
subject: sockets and comm package
 
Similar Threads
Java enabled GPRS module with enabled USB while Java is running?
suggestions required for developing mobile application
Java Comm to USB
read voltage with comm?
Installing Tomcat