Skip to content

Commit 7250f62

Browse files
examples: Update to TCP::listen
1 parent 8f6e9ad commit 7250f62

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

examples/demo_service/service.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ std::string HTML_RESPONSE()
3030
{
3131
const int color = rand();
3232

33-
// Generate some HTML
33+
// Generate some HTML
3434
std::stringstream stream;
3535
stream << "<!DOCTYPE html><html><head>"
3636
<< "<link href='https://fonts.googleapis.com/css?family=Ubuntu:500,300'"
@@ -96,7 +96,7 @@ void Service::start(const std::string&)
9696
});
9797

9898
// Set up a TCP server on port 80
99-
auto& server = inet.tcp().bind(80);
99+
auto& server = inet.tcp().listen(80);
100100

101101
// Add a TCP connection handler - here a hardcoded HTTP-service
102102
server.on_connect(

examples/dualnic/service.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ void Service::start(const std::string&)
8484
{ 8,8,8,8 }); // DNS
8585

8686
// Set up a TCP server on port 80
87-
auto& server1 = inet1.tcp().bind(80);
87+
auto& server1 = inet1.tcp().listen(80);
8888
create_server(server1);
8989

90-
auto& server2 = inet2.tcp().bind(80);
90+
auto& server2 = inet2.tcp().listen(80);
9191
create_server(server2);
9292

9393
// Print some useful netstats every 30 secs

examples/scoped_profiler/service.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void Service::start(const std::string&)
5050
{ 10,0,0,1 }); // DNS
5151

5252
// Set up a TCP server on port 80
53-
auto& server = inet.tcp().bind(80);
53+
auto& server = inet.tcp().listen(80);
5454

5555
server.on_connect([](auto conn)
5656
{

examples/tcp/service.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
/**
2222
* An example to show incoming and outgoing TCP Connections.
2323
* In this example, IncludeOS is listening on port 80.
24-
*
24+
*
2525
* Data received on port 80 will be redirected to a
2626
* outgoing connection to a (in this case) python server (server.py)
27-
*
27+
*
2828
* Data received from the python server connection
2929
* will be redirected back to the client.
30-
*
30+
*
3131
* To try it out, use netcat to connect to this IncludeOS instance.
3232
**/
3333

@@ -61,7 +61,7 @@ void Service::start(const std::string&)
6161
{ 8,8,8,8 }); // DNS
6262

6363
// Set up a TCP server on port 80
64-
auto& server = inet.tcp().bind(80);
64+
auto& server = inet.tcp().listen(80);
6565
printf("Server listening: %s \n", server.local().to_string().c_str());
6666

6767
// When someone connects to our server

test/stress/service.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ void Service::start(const std::string&)
8888
srand(OS::cycles_since_boot());
8989

9090
// Set up a TCP server
91-
auto& server = inet.tcp().bind(80);
91+
auto& server = inet.tcp().listen(80);
9292
inet.tcp().set_MSL(5s);
93-
auto& server_mem = inet.tcp().bind(4243);
93+
auto& server_mem = inet.tcp().listen(4243);
9494

9595
// Set up a UDP server
9696
net::UDP::port_t port = 4242;

0 commit comments

Comments
 (0)