This function reads data from a TCP connection.
|
Parameters |
Description |
|
VM_TCP_HANDLE handle |
[IN] The TCP handle. |
|
void* buffer |
[OUT] The data buffer. |
|
VMUINT length |
[OUT] The data length. |
> 0: reads data size.
= 0: receives the FIN from the server.
< 0: error code, please check VM_TCP_RESULT.
void hl_tcp_conn_cb(VM_TCP_HANDLE handle, VM_TCP_EVENT event) { char buf[100]; VMINT nread, nwrite; switch (event) { case VM_TCP_EVENT_CONNECTED: nwrite = vm_tcp_write( handle, "GET www.mediatek.com HTTP/1.1rnHost: www.mediatek.comrnrn", strlen("GET www.mediatek.com HTTP/1.1rnHost: www.mediatek.comrnrn")); break; case VM_TCP_EVENT_CAN_READ: memset(buf, 0, 100); nread = vm_tcp_read(handle, buf, 100); vm_tcp_close(handle); return; default: return; } return; }
vmtcp.h
Doc-O-Matic. In order to make this message disappear you need to register this software. If you have problems registering this software please contact us at
support@toolsfactory.com.