473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

read FROM com1

Hi

I´m having trouble reading from COM1, writing works like a charm but I´d
like to be able to read the output from a switch or a router in order to
determine that the command was succesful and the configuration actually
went fine :-)

doin´:

$fp = fopen("COM1", "rwb");
fwrite($fp, $username . "\r\n");
if($response == 'password')

works, using hyperterminal shows that I´m logged in and i can actually
config the device as I want, but if I try to do something like :

$fp = fopen("COM1", "rwb");
fwrite($fp, $username . "\r\n");
$response = fread($fp, 4096);
if($response == 'password')
fwrite($fp, $password . "\r\n");
else {
print "no response?";
exit;
}

this is where it ends. Anyone got an idea?

Sincerly
Kim Madsen
Jul 17 '05 #1
1 7318
Kim Madsen - ComX wrote:
Hi

I´m having trouble reading from COM1, writing works like a charm but I´d
like to be able to read the output from a switch or a router in order to
determine that the command was succesful and the configuration actually
went fine :-)


The example from the manual on fgetc works when used as a wrapper:

$handle = fopen("COM1", "r");
while (!feof($handle)) {
$buffer = fgets($handle, 4096);
// do the stuff You wanna do
echo $buffer;
}
fclose($handle);

When starting this script nothing happend, so I figured that the switch
might be locked somehow and I turned it off and on again, then all start
up info FROM the switch was shown on my screen...

--
Sincerly
Kim Madsen
Systemdeveloper / ComX - http://www.comx.dk
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jim.omalley | last post by:
I'm trying to write an interface to send scoreboard data from an XML file generated by a football stats program to a Chyron CODi character generator connected to my COM1 serial port (all operations...
7
by: alexandre_irrthum | last post by:
Hi there, I am trying to use pyserial to read data from a temperature logger device (T-logger). T-logger is based on the DS1615 temperature recorder chip (Dallas Semiconductor). According to the...
5
by: Lee | last post by:
I am getting this error trying to run a win forms .net app using the .net 2.0 serial port control. This occurs when the app tries to open the port. I knwo this is some type of security access...
0
by: maq malik | last post by:
I have a request about com1 port in dev6i how to access the data from com1 in dev6i
1
by: ghjk | last post by:
I'm write code to read data from GSM modem. but it couldn't read modem response. Could you please help me? I'll post my code. using System; using System.Collections.Generic; using...
3
by: dragon123456789 | last post by:
I use system( "mode com1 : baud=9600 parity=n data=8 stop=1 to=off xon=off") to turn on com1 and send some data to MCU. Could anyone tell me how I can retrieve data from MCU without using C++ or MFC...
14
by: ravimishra11 | last post by:
Hi friends, I have written code in asp.net to read or write string in com port(COM1).But when i run the program i am not getting any output .Below is my code .How can i check the string which i...
0
by: ilario santamaria | last post by:
hello I have to dial a telephone number using the com1 Using comport As SerialPort My.Computer.Ports.OpenSerialPort = ( "COM1", 2400) comPort.DtrEnable = True comPort.Write (206-555-1000 ATDT...
11
by: sevak316 | last post by:
Trying to open COM1 in XP using CreateFile and I keep getting INVALID_HANDLE_VALUE. here is the code I am using: //main ............. ..... .... .. .
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.