hi. i would like to ask if the following operation is possible.

imagin a device which has a number of rs 232 ports. in this case we shall take four. then imagin that you have two keyboards and two computers connected to these ports.

now is it possible to write a program in C( or c++ if possible ) in which input from one keyboard connected to one port can be redirected to another port so that it can be directed to a selected computer and serve there as keyboard input?

i have written some rough pseudo code. would you guys mind taking a look at it and say if it possible or not?


start pseudocode

create four variables / most likely pointers
link each of them to one port on the device
 
while (true)
{
    wait for input to apear in one of the variables
 
    write that input onto another variable so that it can go to a second port and to a computer
 
}

Lets see if I have this straight: get input from keyboard on computer #1 and send it via serial port to the keyboard buffer on computer #2. Yes that is certainly possible and will require you to write two different programs -- one for each computer.

not exactly. the keyboards are rs 232 keyboards. they both connect to this device on two of its serial ports and two more ports are cconnected to computers without computers.

this device is an embedded computer which can be programmed(windows CE). can i write a computer program(most likely in C) wich would receive the input on one of its ports and output it again on one of its other ports which can then serve as input for one of the computers.

You probably can't get access to the ports that have keyboards attached because they are probably already in use by the os. I don't know how the os works with two keyboards attached. You can try using keyboard hooks but again two keyboards is problematic. Once you can get the characters typed on the keyboards its a simple matter to xmit them back out a different port.

these are not ordinary keyboards. they are special pupose keyboards. i do not think that they work directly with the operating system because special software listen to events they raise on the com ports.

the computers they work with still have their normal keyboards. they are just added to the computer. and as i said. they raise events which special software listens for.

Dunno, try to replace a node with a link to another node... Anything such is difficult though, as when the module loads, it used to create its nodes, so you have to do that always after the modules load, unless you can uninstall some module or somehow configure it... Hope that you at least want to do that in linux...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.