ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev_win32.c
(Generate patch)

Comparing libev/ev_win32.c (file contents):
Revision 1.7 by root, Fri Jan 2 22:39:31 2009 UTC vs.
Revision 1.10 by root, Sat Mar 28 22:17:17 2009 UTC

1/* 1/*
2 * libev win32 compatibility cruft (_not_ a backend) 2 * libev win32 compatibility cruft (_not_ a backend)
3 * 3 *
4 * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> 4 * Copyright (c) 2007,2008,2009 Marc Alexander Lehmann <libev@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
53ev_pipe (int filedes [2]) 53ev_pipe (int filedes [2])
54{ 54{
55 struct sockaddr_in addr = { 0 }; 55 struct sockaddr_in addr = { 0 };
56 int addr_size = sizeof (addr); 56 int addr_size = sizeof (addr);
57 struct sockaddr_in adr2; 57 struct sockaddr_in adr2;
58 int adr2_size; 58 int adr2_size = sizeof (adr2);
59 SOCKET listener; 59 SOCKET listener;
60 SOCKET sock [2] = { -1, -1 }; 60 SOCKET sock [2] = { -1, -1 };
61 61
62 if ((listener = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET) 62 if ((listener = socket (AF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
63 return -1; 63 return -1;
82 goto fail; 82 goto fail;
83 83
84 if ((sock [1] = accept (listener, 0, 0)) < 0) 84 if ((sock [1] = accept (listener, 0, 0)) < 0)
85 goto fail; 85 goto fail;
86 86
87 /* windows vista returns fantasy port numbers for getpeername. 87 /* windows vista returns fantasy port numbers for sockets:
88 * example for two interconnected tcp sockets: 88 * example for two interconnected tcp sockets:
89 * 89 *
90 * (Socket::unpack_sockaddr_in getsockname $sock0)[0] == 53364 90 * (Socket::unpack_sockaddr_in getsockname $sock0)[0] == 53364
91 * (Socket::unpack_sockaddr_in getpeername $sock0)[0] == 53363 91 * (Socket::unpack_sockaddr_in getpeername $sock0)[0] == 53363
92 * (Socket::unpack_sockaddr_in getsockname $sock1)[0] == 53363 92 * (Socket::unpack_sockaddr_in getsockname $sock1)[0] == 53363

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines