473,396 Members | 1,971 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,396 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 7326
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.