~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to tests/websockets_bi.c

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-06-11 15:45:24 UTC
  • mfrom: (1.2.1) (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130611154524-rppb3w6tixlegv4n
Tags: 1.4.7~20130611~a1eb425-1
* New snapshot release
* Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
 
15
15
#define EXPECTED_BYTES 28
16
16
 
 
17
#ifndef SOCKK
 
18
#define SOCKK 8992
 
19
#endif
 
20
 
17
21
int SocketFD;
18
22
 
19
23
unsigned int get_all_buf(int sock, char* output, unsigned int maxsize)
25
29
  char buffer[1024];
26
30
  int n;
27
31
  unsigned int offset = 0;
 
32
#if TEST_FILE_OPS
 
33
  while((errno = 0, (n = read(sock, buffer, sizeof(buffer)))>0) ||
 
34
#else
28
35
  while((errno = 0, (n = recv(sock, buffer, sizeof(buffer), 0))>0) ||
 
36
#endif
29
37
    errno == EINTR) {
30
38
    if(n>0)
31
39
    {
96
104
  memset(&stSockAddr, 0, sizeof(stSockAddr));
97
105
 
98
106
  stSockAddr.sin_family = AF_INET;
99
 
  stSockAddr.sin_port = htons(
100
 
#if EMSCRIPTEN
101
 
    8993
102
 
#else
103
 
    8992
104
 
#endif
105
 
  );
 
107
  stSockAddr.sin_port = htons(SOCKK);
106
108
  Res = inet_pton(AF_INET, "127.0.0.1", &stSockAddr.sin_addr);
107
109
 
108
110
  if (0 > Res) {