b********n 发帖数: 609 | 1 Requirements:
1. Write 2 standalone C++ applications which communicate over a TCP network socket in a client/server configuration.
2. The server application shall:
a. Listen for TCP connections on a well known IP address and port
b. Accept connections initiated on that port
c. Receive messages from the client and echo them back
d. Continue to do this until the client drops the connection.
3. The client application shall:
a. Estab |
b********n 发帖数: 609 | 2 Additional requirements: do not use boost::asio, or any kind of asynchronous
third-party library.
I have switched to C#/.Net for a while, not sure how to do such low level
socket programming in C++ on Linux. Any ideas? Use select() based
multiplexing or multiple threads?
port
【在 b********n 的大作中提到】 : Requirements: : 1. Write 2 standalone C++ applications which communicate over a TCP network socket in a client/server configuration. : 2. The server application shall: : a. Listen for TCP connections on a well known IP address and port : b. Accept connections initiated on that port : c. Receive messages from the client and echo them back : d. Continue to do this until the client drops the connection. : 3. The client application shall: : a. Estab
|
k***r 发帖数: 4260 | 3 select. There should be plenty of examples online, though.
asynchronous
level
【在 b********n 的大作中提到】 : Additional requirements: do not use boost::asio, or any kind of asynchronous : third-party library. : I have switched to C#/.Net for a while, not sure how to do such low level : socket programming in C++ on Linux. Any ideas? Use select() based : multiplexing or multiple threads? : : port
|
n******t 发帖数: 4406 | 4 I do not think select is asynchronized.
【在 k***r 的大作中提到】 : select. There should be plenty of examples online, though. : : asynchronous : level
|
k***r 发帖数: 4260 | 5 http://squirl.nightmare.com/medusa/async_sockets.html
【在 n******t 的大作中提到】 : I do not think select is asynchronized.
|
n******t 发帖数: 4406 | 6 I think the tutorial is misleading, select is just a way to monitor a group
of file descriptors at the same time, it should be called multiplexing, ther
e is nothing "async" there.
【在 k***r 的大作中提到】 : http://squirl.nightmare.com/medusa/async_sockets.html
|
l******e 发帖数: 12192 | 7 non-blocking send/recv + select + multithreading
group
ther
【在 n******t 的大作中提到】 : I think the tutorial is misleading, select is just a way to monitor a group : of file descriptors at the same time, it should be called multiplexing, ther : e is nothing "async" there.
|
r*********r 发帖数: 3195 | 8 boost::asio uses "select" on platform that doesn't support aio_read,
that is, it use a reactor to implement a proactor.
the application level can create the illusion of async even if OS doesn't
support it. |
a****l 发帖数: 8211 | 9 讨论一下要求3.b,似乎不太合理:"neither the sending nor the receiving of a
given message should block the sending and receiving of the subsequent
message"
显然,发包的时候不阻止收包,收包的时候不阻止发包是非常合理的要求,但是这句话似
乎还包括说要求"发包的时候不阻止发下一个包,收包的时候不阻止收下一个包",这好象
不太可能.一个口上的tcp其实就是一个唯一的系统资源,一个TCP的包发到一半,你怎么
可以中止这个包发别的东西呢?tcp好象是没有这种"断点续传"的功能的吧.最多是在应
用层把大的数据块切小,这样看上去是象non-blocking,其实也仅仅是感觉吧.
network socket in a client/server configuration.
port
address and port
server in an asynchronous manner (i.e. neither the sending nor the
【在 b********n 的大作中提到】 : Requirements: : 1. Write 2 standalone C++ applications which communicate over a TCP network socket in a client/server configuration. : 2. The server application shall: : a. Listen for TCP connections on a well known IP address and port : b. Accept connections initiated on that port : c. Receive messages from the client and echo them back : d. Continue to do this until the client drops the connection. : 3. The client application shall: : a. Estab
|
n******t 发帖数: 4406 | 10 none of these are "async"
【在 l******e 的大作中提到】 : non-blocking send/recv + select + multithreading : : group : ther
|
|
|
b********n 发帖数: 609 | 11 I think it just meant sending and receiving messages independently, so you
can't write code like "send(...); recv(...);".
【在 a****l 的大作中提到】 : 讨论一下要求3.b,似乎不太合理:"neither the sending nor the receiving of a : given message should block the sending and receiving of the subsequent : message" : 显然,发包的时候不阻止收包,收包的时候不阻止发包是非常合理的要求,但是这句话似 : 乎还包括说要求"发包的时候不阻止发下一个包,收包的时候不阻止收下一个包",这好象 : 不太可能.一个口上的tcp其实就是一个唯一的系统资源,一个TCP的包发到一半,你怎么 : 可以中止这个包发别的东西呢?tcp好象是没有这种"断点续传"的功能的吧.最多是在应 : 用层把大的数据块切小,这样看上去是象non-blocking,其实也仅仅是感觉吧. : : network socket in a client/server configuration.
|
l******e 发帖数: 12192 | 12 可以实现async socket呀
【在 n******t 的大作中提到】 : none of these are "async"
|
b********n 发帖数: 609 | 13 I think I need message broker to have registered handlers for sending and
receiving messages. OMG, it's too much for an interview project...
【在 n******t 的大作中提到】 : none of these are "async"
|
l******e 发帖数: 12192 | 14 it's way too easy, man
【在 b********n 的大作中提到】 : I think I need message broker to have registered handlers for sending and : receiving messages. OMG, it's too much for an interview project...
|
b********n 发帖数: 609 | 15 one thread calling send and another thread calling recv?
【在 l******e 的大作中提到】 : it's way too easy, man
|
n******t 发帖数: 4406 | 16 YOu can use signal driven IO, and posix async IO api,
but I am wondering why use TCP then.
【在 b********n 的大作中提到】 : I think I need message broker to have registered handlers for sending and : receiving messages. OMG, it's too much for an interview project...
|
b********n 发帖数: 609 | 17 It has to be a client-server architecture...
【在 n******t 的大作中提到】 : YOu can use signal driven IO, and posix async IO api, : but I am wondering why use TCP then.
|
M*****a 发帖数: 2054 | 18 用select阿
简单的一笔雕凿
network socket in a client/server configuration.
port
address and port
server in an asynchronous manner (i.e. neither the sending nor the
subsequent message). The format of the message is of your choice; however,
it must contain enough information in order for it to be recognized on its
return from the server. These : c. Calculate and display the
round trip time for each message, the running average round trip time for
all messages and the running throughput rate for
【在 b********n 的大作中提到】 : Requirements: : 1. Write 2 standalone C++ applications which communicate over a TCP network socket in a client/server configuration. : 2. The server application shall: : a. Listen for TCP connections on a well known IP address and port : b. Accept connections initiated on that port : c. Receive messages from the client and echo them back : d. Continue to do this until the client drops the connection. : 3. The client application shall: : a. Estab
|
a****l 发帖数: 8211 | 19 that's an interesting question, which leads to a very interesting topic.
network socket in a client/server configuration.
port
address and port
server in an asynchronous manner (i.e. neither the sending nor the
【在 b********n 的大作中提到】 : Requirements: : 1. Write 2 standalone C++ applications which communicate over a TCP network socket in a client/server configuration. : 2. The server application shall: : a. Listen for TCP connections on a well known IP address and port : b. Accept connections initiated on that port : c. Receive messages from the client and echo them back : d. Continue to do this until the client drops the connection. : 3. The client application shall: : a. Estab
|