Good day all :
I have an issue here, i try to use php to send the SMS via my 3G USB modem, as I try to send it with hyperterminal, it works perfectly with COM port number 27.
as I try to fopen COM port 27 it return with the following error message : Warning: fopen(COM27: ) [function.fopen]: failed to open stream: Invalid argument in C:\AppServ\www\home\test\sms\com_connect.php on line 4

but if i fopen the COM port 1 to 4, it actually connected to the COM port, which means I can only connect to COM port 1 to 4, from COM5 onward, i wont be able to connect. any idea why ?

exec("mode COM27 BAUD=9600 PARITY=N data=8 stop=1 xon=off");  
$fp = fopen ("COM27:", "w+"); if (!$fp) {
echo "Not open"; } else { echo "opened"; fclose($fp); }

P.S. I use the port monitor software to monitor the ports, when I connect to COM port 1-4 it actually receive the request, but it receive nothing when I try COM5 onward.
and I'm running apache on windows. please help. and thank you in advance

    Way back in time (at least half a dozen years ago) when I was doing stuff with com ports in a Windows environment, there were only 4 ports available, if I recall correctly. So, if you're in an environment that supports more than 4, is it possible the code/library you're using thinks only 4 could possibly exist?

      Windows does reserve filenames like COM1 through COM4 as aliases for the corresponding ports (hence the inability to create a file named "COM3" - it already "exists"). This dates from when there were only a very few such ports on a machine, and I don't think Microsoft thought it would be a good idea to start claiming more - "no-one will ever need more than four serial ports" (hence the ability to create a file named "COM27").

        Write a Reply...