|
我各人写了一段程序,就是想通过手机向一个只定的电脑传送数据,可手机好像根本联不上网,我用卡是全球通卡,手机支持GPRS.以下是代码:
void net1(void)
{
unsigned char buf[2*1024];
char len;
signed char conn;
sockaddr_struct daddr;
conn=soc_create(PF_INET, SOCK_STREAM, IPPROTO_IP, MOD_MMI, 14);
memset(&daddr,0x00,sizeof(sockaddr_struct));
daddr.addr_len=4;
daddr.addr[0] = 192;
daddr.addr[1] = 168;
daddr.addr[2] = 1;
daddr.addr[3] = 100;
daddr.port = 9999;
kal_prompt_trace(MOD_MMI,"NET_Connect: sock_addr,%d,%d,%d,%d,%d",daddr.addr[0],daddr.addr[1],daddr.addr[2],daddr.addr[3],daddr.port);
soc_connect(conn,&daddr);
strcpy((char *)buf,"HELLO ");
len = strlen((const char *)buf);
// sprintf(buff,"GET%s\r\n\r\n",filepath);
soc_send(conn,buf, len+7,0);
soc_close(conn);
}
编译后过程没问题,就是下载到手机后,数据发送不成功.只定的电脑收不到数据.求大虾们指点 |
|