Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
774304da
Commit
774304da
authored
Jan 13, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Authors: Jeremy White <jwhite@codeweavers.com>, Francois Gouget <fgouget@codeweavers.com>
Test the behavior of bind() wrt. SO_REUSEADDR.
parent
0d914dfd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
sock.c
dlls/winsock/tests/sock.c
+41
-0
No files found.
dlls/winsock/tests/sock.c
View file @
774304da
...
...
@@ -625,6 +625,45 @@ static void do_test( test_setup *test )
CloseHandle
(
client_ready
[
i
]
);
}
static
void
test_so_reuseaddr
()
{
struct
sockaddr_in
saddr
;
SOCKET
s1
,
s2
;
int
rc
,
reuse
,
size
;
saddr
.
sin_family
=
AF_INET
;
saddr
.
sin_port
=
htons
(
9375
);
saddr
.
sin_addr
.
s_addr
=
inet_addr
(
"127.0.0.1"
);
s1
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
s1
!=
INVALID_SOCKET
,
"socket() failed error: %d
\n
"
,
WSAGetLastError
());
rc
=
bind
(
s1
,
(
struct
sockaddr
*
)
&
saddr
,
sizeof
(
saddr
));
ok
(
rc
!=
SOCKET_ERROR
,
"bind(s1) failed error: %d
\n
"
,
WSAGetLastError
());
s2
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
ok
(
s2
!=
INVALID_SOCKET
,
"socket() failed error: %d
\n
"
,
WSAGetLastError
());
reuse
=
0x1234
;
size
=
sizeof
(
reuse
);
rc
=
getsockopt
(
s2
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
reuse
,
&
size
);
ok
(
rc
==
0
&&
reuse
==
0
,
"wrong result in getsockopt(SO_REUSEADDR): rc=%d reuse=%d
\n
"
,
rc
,
reuse
);
rc
=
bind
(
s2
,
(
struct
sockaddr
*
)
&
saddr
,
sizeof
(
saddr
));
ok
(
rc
==
SOCKET_ERROR
,
"bind() succeeded
\n
"
);
reuse
=
1
;
rc
=
setsockopt
(
s2
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
char
*
)
&
reuse
,
sizeof
(
reuse
));
ok
(
rc
==
0
,
"setsockopt() failed error: %d
\n
"
,
WSAGetLastError
());
todo_wine
{
rc
=
bind
(
s2
,
(
struct
sockaddr
*
)
&
saddr
,
sizeof
(
saddr
));
ok
(
rc
==
0
,
"bind() failed error: %d
\n
"
,
WSAGetLastError
());
}
closesocket
(
s2
);
closesocket
(
s1
);
}
/************* Array containing the tests to run **********/
#define STD_STREAM_SOCKET \
...
...
@@ -686,6 +725,8 @@ START_TEST( sock )
int
i
;
Init
();
test_so_reuseaddr
();
for
(
i
=
0
;
i
<
NUM_TESTS
;
i
++
)
{
trace
(
" **** STARTING TEST %d ****
\n
"
,
i
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment