|
我使用如下代码连接网关不成功,请对展讯socket熟悉的xdjm提点一下,再下,不胜感激!
struct sci_sockaddr him;
int sock= -1;
SCI_TRACE_LOW("deng_MMIBROWSER_GetApn():%s",MMIBROWSER_GetApn());
if(ERR_MNGPRS_NO_ERR != MNGPRS_SetAndActivePdpContext(MMIBROWSER_GetApn()))
{
SCI_TRACE_LOW("deng_open GPRS FAILED1");
}
else
{
SCI_TRACE_LOW("deng_open GPRS OK1");
}
sock = sci_sock_socket(AF_INET, SOCK_STREAM,0);
if(sock == -1)
{
SCI_TRACE_LOW("deng_build error\n");
}
else
{
int temp;
him.family = AF_INET;
him.ip_addr = (10<<24)+172;
him.port = htons(80);
temp = sci_sock_connect(sock, &him,sizeof(struct sci_sockaddr));
if(temp<0)
{
int test1;
SCI_TRACE_LOW("deng_false1\n");
test1 = sci_sock_errno(sock);
SCI_TRACE_LOW("deng_1errorno:%d",test1);
him.ip_addr = (172<<24)+10;
temp = sci_sock_connect(sock, &him,sizeof(struct sci_sockaddr));
if(temp<0)
{
int test2;
SCI_TRACE_LOW("deng_false2\n");
test2 = sci_sock_errno(sock);
SCI_TRACE_LOW("deng_2errorno:%d",test2);
}
else
{
SCI_TRACE_LOW("deng_good1\n");
}
}
}
trace如下:
1092-1:deng_MMIBROWSER_GetApn():cmwap
1099-2:deng_open GPRS OK1
1099-3:deng_**************
1099-4:TCPIP:creat socket 0x04147d94
1099-5:deng_****************
1099-6:deng_false1
1099-7:deng_1errorno:19
1099-8:deng_false2
1099-9:deng_2errorno:19 |
|