Syntax
VM_TCP_HANDLE vm_tcp_connect(
    const char* host, 
    const VMINT port, 
    VM_BEARER_DATA_ACCOUNT_TYPE data_account_type, 
    void* user_data, 
    vm_tcp_connect_callback connect_callback
);
ContentsIndex
PreviousUpNext
vm_tcp_connect
Example
Syntax
VM_TCP_HANDLE vm_tcp_connect(
    const char* host, 
    const VMINT port, 
    VM_BEARER_DATA_ACCOUNT_TYPE data_account_type, 
    void* user_data, 
    vm_tcp_connect_callback connect_callback
);
Description

This function creates a TCP connection to the host.

Parameters
Parameters 
Description 
const char* host 
[IN] The destination host IP. 
const VMINT port 
[IN] The destination host port. 
VM_BEARER_DATA_ACCOUNT_TYPE data_account_type 
[IN] The data account to use. 
void* user_data 
[IN] The user data. 
callback 
[IN] The callback function for TCP connection. 
Returns

If successful, it returns the TCP handle; 

If Fails, it returns a VM_TCP_RESULT.

Example
 static VMINT g_hl_tcp_hd;
 void hl_tcp_conn_cb_ex(VM_TCP_HANDLE handle, VM_TCP_EVENT event, void* user_data)
 {
     char* my_data = (char*)user_data;
     switch (event)
     {
         case VM_TCP_EVENT_CONNECTED:
          //do something here
             vm_tcp_close(handle);
             return;
         default:
             return;
     }
 }
 void hl_tcp_connect(void)
 {
     char* my_data;
     my_data = (char*)vm_malloc(10);
     strcpy(my_data, "aa");
     vm_enable_proxy(FALSE);
     g_hl_tcp_hd = vm_tcp_connect("www.mediatek.com", 80, VM_BEARER_DATA_ACCOUNT_TYPE_GPRS_NONE_PROXY_APN, (void )my_data, hl_tcp_conn_cb_ex);

 }
File

vmtcp.h

Group
Created with a commercial version of 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.