Change port numbers to avoid a clash on windows.
This commit is contained in:
parent
511abc213e
commit
5d965babda
@ -10,10 +10,10 @@ class dgram_handler
|
|||||||
public:
|
public:
|
||||||
dgram_handler(demuxer& d)
|
dgram_handler(demuxer& d)
|
||||||
: demuxer_(d),
|
: demuxer_(d),
|
||||||
socket_(d, inet_address_v4(12347)),
|
socket_(d, inet_address_v4(32123)),
|
||||||
count_(0)
|
count_(0)
|
||||||
{
|
{
|
||||||
inet_address_v4 destination(12346, "localhost");
|
inet_address_v4 destination(32124, "localhost");
|
||||||
char msg[] = "Hello, World!\n";
|
char msg[] = "Hello, World!\n";
|
||||||
memcpy(data_, msg, sizeof(msg));
|
memcpy(data_, msg, sizeof(msg));
|
||||||
socket_.async_sendto(data_, sizeof(msg) - 1, destination,
|
socket_.async_sendto(data_, sizeof(msg) - 1, destination,
|
||||||
|
@ -9,7 +9,7 @@ class dgram_handler
|
|||||||
public:
|
public:
|
||||||
dgram_handler(demuxer& d)
|
dgram_handler(demuxer& d)
|
||||||
: demuxer_(d),
|
: demuxer_(d),
|
||||||
socket_(d, inet_address_v4(12346))
|
socket_(d, inet_address_v4(32124))
|
||||||
{
|
{
|
||||||
socket_.async_recvfrom(data_, max_length, sender_address_,
|
socket_.async_recvfrom(data_, max_length, sender_address_,
|
||||||
boost::bind(&dgram_handler::handle_recvfrom, this, _1, _2));
|
boost::bind(&dgram_handler::handle_recvfrom, this, _1, _2));
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
{
|
{
|
||||||
echo_session* new_session = new echo_session(demuxer_);
|
echo_session* new_session = new echo_session(demuxer_);
|
||||||
connector_.async_connect(new_session->socket(),
|
connector_.async_connect(new_session->socket(),
|
||||||
inet_address_v4(12345, "localhost"),
|
inet_address_v4(32123, "localhost"),
|
||||||
boost::bind(&echo_client::handle_connect, this, new_session, _1));
|
boost::bind(&echo_client::handle_connect, this, new_session, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ public:
|
|||||||
{
|
{
|
||||||
echo_session* new_session = new echo_session(demuxer_);
|
echo_session* new_session = new echo_session(demuxer_);
|
||||||
connector_.async_connect(new_session->socket(),
|
connector_.async_connect(new_session->socket(),
|
||||||
inet_address_v4(12345, "localhost"),
|
inet_address_v4(32123, "localhost"),
|
||||||
boost::bind(&echo_client::handle_connect, this, new_session, _1));
|
boost::bind(&echo_client::handle_connect, this, new_session, _1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class echo_server
|
|||||||
public:
|
public:
|
||||||
echo_server(demuxer& d)
|
echo_server(demuxer& d)
|
||||||
: demuxer_(d),
|
: demuxer_(d),
|
||||||
acceptor_(d, inet_address_v4(12345))
|
acceptor_(d, inet_address_v4(32123))
|
||||||
{
|
{
|
||||||
echo_session* new_session = new echo_session(demuxer_);
|
echo_session* new_session = new echo_session(demuxer_);
|
||||||
acceptor_.async_accept(new_session->socket(),
|
acceptor_.async_accept(new_session->socket(),
|
||||||
|
@ -9,7 +9,7 @@ class accept_handler
|
|||||||
public:
|
public:
|
||||||
accept_handler(demuxer& d)
|
accept_handler(demuxer& d)
|
||||||
: demuxer_(d),
|
: demuxer_(d),
|
||||||
acceptor_(d, inet_address_v4(12345)),
|
acceptor_(d, inet_address_v4(32123)),
|
||||||
peer_(d),
|
peer_(d),
|
||||||
handler_(boost::bind(&accept_handler::handle_accept, this, _1)),
|
handler_(boost::bind(&accept_handler::handle_accept, this, _1)),
|
||||||
accept_count_(0)
|
accept_count_(0)
|
||||||
|
@ -10,7 +10,7 @@ public:
|
|||||||
dgram_handler(demuxer& d)
|
dgram_handler(demuxer& d)
|
||||||
: demuxer_(d),
|
: demuxer_(d),
|
||||||
timer_queue_(d),
|
timer_queue_(d),
|
||||||
socket_(d, inet_address_v4(12346))
|
socket_(d, inet_address_v4(32124))
|
||||||
{
|
{
|
||||||
socket_.async_recvfrom(data_, max_length, sender_address_,
|
socket_.async_recvfrom(data_, max_length, sender_address_,
|
||||||
boost::bind(&dgram_handler::handle_recvfrom, this, _1, _2));
|
boost::bind(&dgram_handler::handle_recvfrom, this, _1, _2));
|
||||||
|
@ -28,7 +28,7 @@ void tpc_echo_session(stream_socket_ptr sock)
|
|||||||
|
|
||||||
void tpc_echo_server(demuxer& d)
|
void tpc_echo_server(demuxer& d)
|
||||||
{
|
{
|
||||||
socket_acceptor a(d, inet_address_v4(12345));
|
socket_acceptor a(d, inet_address_v4(32123));
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
stream_socket_ptr sock(new stream_socket(d));
|
stream_socket_ptr sock(new stream_socket(d));
|
||||||
|
Loading…
Reference in New Issue
Block a user