Re: Using TcpClient with Modem by den2005
den2005
Thu Dec 22 18:17:02 CST 2005
Thanks for reply, tdavisjr.
Right now, I stick with ver 1.1. Do you know anything about these api I
found which deals with serial ports communication.
Do you or anybody knows how to use this following api? Is there can be
definite and simple sample how to use them to say establish serial port
connection in order to connect to gprs modem to send and recieve? Right now,
this is approach I am pursuing to solve this problem. Info would be great??
Thanks
[DllImport("kernel32.dll")]
private static extern Boolean GetCommProperties(IntPtr hFile, out COMMPROP
cp);
[DllImport("kernel32.dll")]
private static extern Boolean GetCommModemStatus(IntPtr hFile, out UInt32
lpModemStat);
[DllImport("kernel32.dll")]
private static extern Boolean GetCommState(IntPtr hFile, ref DCB lpDCB);
[DllImport("kernel32.dll")]
private static extern Boolean SetCommState(IntPtr hFile, [In] ref DCB lpDCB);
[DllImport("kernel32.dll", SetLastError=true)]
private static extern IntPtr CreateFile(String lpFileName, UInt32
dwDesiredAccess, UInt32 dwShareMode, IntPtr lpSecurityAttributes, UInt32
dwCreationDisposition, UInt32 dwFlagsAndAttributes, IntPtr hTemplateFile);
[DllImport("kernel32.dll")]
private static extern Boolean CloseHandle(IntPtr hObject);
[DllImport("kernel32.dll", SetLastError=true)]
private static extern Boolean ReadFile(IntPtr hFile, [Out] Byte[] lpBuffer,
UInt32 nNumberOfBytesToRead, out UInt32 nNumberOfBytesRead, IntPtr
lpOverlapped);
[DllImport("kernel32.dll", SetLastError=true)]
private static extern Boolean WriteFile(IntPtr fFile, Byte[] lpBuffer,
UInt32 nNumberOfBytesToWrite, out UInt32 lpNumberOfBytesWritten, IntPtr
lpOverlapped);
[DllImport("kernel32.dll")]
private static extern Boolean CancelIo(IntPtr hFile);
[DllImport("kernel32.dll")]
private static extern Boolean TransmitCommChar(IntPtr hFile, Byte cChar);
[DllImport("kernel32.dll")]
internal static extern Boolean SetupComm(IntPtr hFile, UInt32 dwInQueue,
UInt32 dwOutQueue);
den2005
--
MCP Year 2005, Philippines
"tdavisjr" wrote:
> Nope. If you don't have VS 2005 then try downloading the Free Express
> versions. It will allow you to at least play around with some of the
> ..NET 2.0 classes. But you can't compile 2.0 classes with VS.NET 2003
>
>