Changeset 1235 for pjproject/trunk/pjlib/src/pjlib-test/sock.c
- Timestamp:
- Apr 30, 2007 9:03:32 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pjlib-test/sock.c
r1029 r1235 64 64 #define UDP_PORT 51234 65 65 #define TCP_PORT (UDP_PORT+10) 66 #define BIG_DATA_LEN 900066 #define BIG_DATA_LEN 8192 67 67 #define ADDRESS "127.0.0.1" 68 #define A0 12769 #define A1 070 #define A2 071 #define A3 172 73 68 74 69 static char bigdata[BIG_DATA_LEN]; … … 83 78 pj_sockaddr_in addr2; 84 79 const pj_str_t *hostname; 80 #if defined(PJ_SYMBIAN) && PJ_SYMBIAN!=0 81 /* Symbian IP address is saved in host order */ 82 unsigned char A[] = {1, 0, 0, 127}; 83 #else 84 unsigned char A[] = {127, 0, 0, 1}; 85 #endif 85 86 86 87 PJ_LOG(3,("test", "...format_test()")); … … 92 93 /* Check the result. */ 93 94 p = (unsigned char*)&addr; 94 if (p[0]!=A 0 || p[1]!=A1 || p[2]!=A2 || p[3]!=A3) {95 if (p[0]!=A[0] || p[1]!=A[1] || p[2]!=A[2] || p[3]!=A[3]) { 95 96 PJ_LOG(3,("test", " error: mismatched address. p0=%d, p1=%d, " 96 97 "p2=%d, p3=%d", p[0] & 0xFF, p[1] & 0xFF, … … 369 370 goto on_error; 370 371 372 // This test will fail on S60 3rd Edition MR2 373 #if 0 371 374 /* connect() the sockets. */ 372 375 rc = pj_sock_connect(cs, &dstaddr, sizeof(dstaddr)); … … 386 389 if (rc != 0) 387 390 goto on_error; 391 #endif 388 392 389 393 on_error: … … 460 464 } 461 465 466 #if 0 467 #include "../pj/os_symbian.h" 468 static int connect_test() 469 { 470 RSocketServ rSockServ; 471 RSocket rSock; 472 TInetAddr inetAddr; 473 TRequestStatus reqStatus; 474 char buffer[16]; 475 TPtrC8 data((const TUint8*)buffer, (TInt)sizeof(buffer)); 476 int rc; 477 478 rc = rSockServ.Connect(); 479 if (rc != KErrNone) 480 return rc; 481 482 rc = rSock.Open(rSockServ, KAfInet, KSockDatagram, KProtocolInetUdp); 483 if (rc != KErrNone) 484 { 485 rSockServ.Close(); 486 return rc; 487 } 488 489 inetAddr.Init(KAfInet); 490 inetAddr.Input(_L("127.0.0.1")); 491 inetAddr.SetPort(80); 492 493 rSock.Connect(inetAddr, reqStatus); 494 User::WaitForRequest(reqStatus); 495 496 if (reqStatus != KErrNone) { 497 rSock.Close(); 498 rSockServ.Close(); 499 return rc; 500 } 501 502 rSock.Send(data, 0, reqStatus); 503 User::WaitForRequest(reqStatus); 504 505 if (reqStatus!=KErrNone) { 506 rSock.Close(); 507 rSockServ.Close(); 508 return rc; 509 } 510 511 rSock.Close(); 512 rSockServ.Close(); 513 return KErrNone; 514 } 515 #endif 516 462 517 int sock_test() 463 518 { … … 466 521 pj_create_random_string(bigdata, BIG_DATA_LEN); 467 522 523 // Enable this to demonstrate the error witn S60 3rd Edition MR2 524 #if 0 525 rc = connect_test(); 526 if (rc != 0) 527 return rc; 528 #endif 529 468 530 rc = format_test(); 469 531 if (rc != 0)
Note: See TracChangeset
for help on using the changeset viewer.