Click to See Complete Forum and Search --> : Cannot find the port number.


Ibrahim Said
October 7th, 1999, 07:20 AM
Hi,
My problem is that I'm s'posed to transfer data thro' a modem. But I cannot find the port number of COM1 to which the modem is connected. I need the port number as the first parameter of CAsyncSocket::Create() function. This is urgent
Grateful if you could send some accompanying code.
Thanks.

karim4
October 7th, 1999, 07:30 AM
!!! CAsyncSocket is for a socket comunication
the port parameter is not a phisical port

for a data transfer using a connection on the internet use the ftp protocol or other (HTTP ..)

Ibrahim Said
October 8th, 1999, 04:50 AM
Hi Karim. You see, this still doesn't solve my problem. Let me explain it to you in detail. I need to communicate between two systems using a modem which is connected using a serial port. Now, I have made a Client and Server applications which are working just fine so long as they communicate using a hub. This means that the ethernet cards of each system is connected to the hub using a RJ45 connector.
But if I do the sameby connecting the serial ports, they don't communicate. This means that my programs do not have the right serial port no. I need this as the modem is connected using the serial port.
My concepts might be wrong as I am new in this field. Please help me. I can really do with some sample Client-Server applications. Thanks.

Another thing, whenever I try to bind my socket to an address using CAsyncSocket::Bind it gives an error WASEINVAL(socket already has an address). When I get the address using CAsyncSocket::GetSockName the address string is "0.0.0.0". Also, CAsyncSocket::GetPeerName gives a blank string address ie, "". Why so?
Thanks again.

Jason Teagle
October 8th, 1999, 06:27 AM
Modems usually ARE connected to serial ports - if you have dial-up networking to get to the internet, then YOU have a modem on your serial port (OK, it might be internal to your machine, but it IS there). As you will see in a response I gave you in a later post, the dial-up networking part is a separate setup from the sockets - the sockets will only work if you already have an internet connection (i.e., modem is communicating). Therefore, you need to establish that connection first. This will either happen automatically when you try to use a socket to listen or connect, or you may have to use one of the RAS functions to get that connection running - THEN you can use sockets as normal.

You don't need to call Bind() on a CXXXSocket - it is implicit. Just call the proper Create() function and then Listen() or Connect(), and it will work.

Ibrahim Said
October 11th, 1999, 11:12 PM
Thanks again.