USB PC to PC communication in Visual Basic

B

Thread Starter

Bert

Hello All,

A while ago, I developed a system in which two specialized applications written in VB6 running on two different computers needed to exchange data in real time via a serial interface (std RS232 COM port). One of the two computers is a laptop which one operator connects regularly to a host computer and reads data and sends data as well. Today's computers do not have COM ports anymore. We have used USB to Serial adapters and it does not work so well anymore. It seems that these adaptors tend to jam the communication from time to time, which never happenned before. We have tried 6 different brands with no success. We would like to get rid of these adapters and modify our code in both applications so that the computers could communicate with a direct USB to USB link.

In the original software, the communication part was written using MSCOMM32.OCX. I have not found anything equivalent for USB communication.

Any suggestion anybody?
 
W

William Sturm

You don't say which compiler or language that you are planning to use. Based on the fact that you were using VB6, it is a safe bet that you are considering VB.Net

It is difficult in .NET also to send ascii data between two computers. With Ethernet on must learn remoting or web services, what happened to a simple socket interface. USB is probably even harder.

My suggestion is to buy PCI RS-232 cards and use a serial library. It is old school, but it still works well and is relatively simple. Microsoft recently added serial communication support to .NET, maybe serial is not so dead after all.

I needed to do this this last year and just got fed up and used VB6 and MSComm.

Bill
 
M

Michael Batchelor

I think you fail to understand how USB works. The Computer has a "USB Controller" that acts like a bus master. You cannot connect two USB bus
masters to the same peripheral bus. It just doesn't work that way.

USB might be serial data, but it isn't exactly like an RS-232 port where the two computers are "peers". Think about it as if you were trying to hook two computers together through two SCSI controllers. It just "won't work" they
way you want it to.

What you can do is use two usb-ethernet adapters and change the communications to use Ethernet, but in that case why mess with the usb. Just use two NIC cards.

Michael
--
Michael R. Batchelor
www.ind-info.com

GUERRILLA MAINTENANCE [TM] PLC Training
5 Day Hands on PLC Boot Camp for Allen Bradley
PLC-5, SLC-500, and ControlLogix
www.ind-info.com/schedule.html
[email protected]

Industrial Informatics, Inc.
1013 Bankton Cir., Suite C
Hanahan, SC 29406

843-329-0342 x111 Voice
843-412-2692 Cell
843-329-0343 FAX
 
M

Michael Batchelor

That's a good question! I don't think I've ever seen one of these, and if I have, I know that I didn't realize what it was.

But you can bet that I'm going to figure it out now.

Maybe the answer is that *I AM* the one who fails to understand how USB works. Nothing like exposing yourself in public!!!

MB
 
M

Michael Griffin

In reply to Nathan Boeger: It's not just a cable. It has a "magic box" in the middle. I believe that these devices use a shared memory buffer in the middle which both USB masters read and write (similar in principle to the boxes used to let Profibus DP masters talk to each other).

A number of companies sell these cables, and I suspect that each uses a different proprietary protocol. You need to have proprietary software (part of the product) running at each end in order to use it. In the "old days", you used to do things like this with serial or parallel cables.

Unless someone has reverse engineered the protocol, I don't think much can be done with these cables.
 
S
I'd suggest forgetting about using USB, and simply use an IP Socket communication and have the machines connected via Ethernet.

It's a lot easier to do than USB or serial, and there's a lot of example code around.

-Steve
 
I need to convert RS-232 interface to USB to connect to a Pocket PC. I have hardware that supports only RS-232, and it has to work on my PC and a Pocket PC. Pocket PC supports only USB. Any shareware library available? Or suggestions on how to proceed is appreciated.
 
Don't be stupid, man, IT IS NOT POSSIBLE, thus you need to design a driver to indicate which kind of device is conected to the PC. With the driver you can make the connection between two computers OK!!!

BEST REGARDS!!! AND I HOPE HAPPY DESIGN OF THE DRIVER, YOU KNOW HOW TO PROGRAM IN ASM?
 
S

saurabh A Dixit

Yes friend,

For same thing I was searching. Now I come to know that it's not possible using MSCOMM.OCX to comunicate for USB. It's only for RS232. So if you got anything for USB communication from PC to PC using VB, C++ or anything else.
 
I wish I could have replied to this remark in a timely manner to dispute the remark. VB IP controls are simple enough to use if you know what end you wish to achieve. In other words, it would take no time at all to learn the IP (FTP, Inet, etc) control if you know what want to do.
 
As a side note on this, if you try to hook two PCs together with a regular USB cable, you will burn out the USB ports.
 
Hi,

Is there any chance that you can send me the program which communicates between 2 PCs using Visual Basic, as I really need it for my final year project. Can you please send me code? Just email it to me on sachin_sardana @ hotmail. com Anyone please help.
 
S

Sangram Bhosale

Hi friends.

I'm student of computer engineering. I would also like to get the code of the same. If any one knows the source code, then please forward me.

e-mail: sangram_bhosale1 @ rediff. com
 
Top