Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TCP/IP
#4
net and the related QM TCP/IP server cannot be used by other software. Specific protocol, passwords, etc.

------------------

Try this TCP/IP client class.

Macro TcpIpClient help
Code:
Copy      Help
;Sends and receives data using TCP/IP.
;A variable of TcpIpClient type also can be used with Winsock functions as SOCKET variable.
;When a function fails, it returns 0. To get error code, call WSAGetLastError.

;EXAMPLE

;Connects to http server and downloads file.

out
#compile "__TcpIpClient"
TcpIpClient x

str server="en.wikipedia.org"
str getfile="/wiki/Hypertext_Transfer_Protocol"
str receivedData

out "---- connecting ----"

if(!x.Connect(server 80)) end "failed"

out "---- sending request ----"

str request.format("GET %s HTTP/1.0[]User-Agent: Quick Macros[]Host: %s[][]" getfile server)
if(!x.Send(request)) end "failed"

out "---- receiving ----"

if(!x.Receive(receivedData)) end "failed"

out "---- received: ----"
out receivedData


Attached Files
.qml   Winsock TCP IP client.qml (Size: 3.75 KB / Downloads: 579)


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)