John Lowe
/
WebSockets2
Embedded WebSockets Experiment
Core/TCPItem.cpp@0:6dee052a3fa4, 2011-07-26 (annotated)
- Committer:
- nandgate
- Date:
- Tue Jul 26 05:30:53 2011 +0000
- Revision:
- 0:6dee052a3fa4
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nandgate | 0:6dee052a3fa4 | 1 | #include "TCPItem.h" |
nandgate | 0:6dee052a3fa4 | 2 | |
nandgate | 0:6dee052a3fa4 | 3 | using namespace std; |
nandgate | 0:6dee052a3fa4 | 4 | using namespace mbed; |
nandgate | 0:6dee052a3fa4 | 5 | |
nandgate | 0:6dee052a3fa4 | 6 | void TCPItem::abort() const { |
nandgate | 0:6dee052a3fa4 | 7 | tcp_abort(this->_pcb); |
nandgate | 0:6dee052a3fa4 | 8 | } |
nandgate | 0:6dee052a3fa4 | 9 | |
nandgate | 0:6dee052a3fa4 | 10 | void TCPItem::release_callbacks() const { |
nandgate | 0:6dee052a3fa4 | 11 | tcp_arg(this->_pcb, NULL); |
nandgate | 0:6dee052a3fa4 | 12 | tcp_sent(this->_pcb, NULL); |
nandgate | 0:6dee052a3fa4 | 13 | tcp_recv(this->_pcb, NULL); |
nandgate | 0:6dee052a3fa4 | 14 | tcp_poll(this->_pcb, NULL, 255); |
nandgate | 0:6dee052a3fa4 | 15 | tcp_accept(this->_pcb, NULL); |
nandgate | 0:6dee052a3fa4 | 16 | tcp_err(this->_pcb, NULL); |
nandgate | 0:6dee052a3fa4 | 17 | } |
nandgate | 0:6dee052a3fa4 | 18 | |
nandgate | 0:6dee052a3fa4 | 19 | err_t TCPItem::close() { |
nandgate | 0:6dee052a3fa4 | 20 | err_t err = tcp_close(this->_pcb); |
nandgate | 0:6dee052a3fa4 | 21 | this->_pcb = NULL; |
nandgate | 0:6dee052a3fa4 | 22 | return err; |
nandgate | 0:6dee052a3fa4 | 23 | } |
nandgate | 0:6dee052a3fa4 | 24 | |
nandgate | 0:6dee052a3fa4 | 25 | void TCPItem::open() { |
nandgate | 0:6dee052a3fa4 | 26 | if(!this->_pcb) { |
nandgate | 0:6dee052a3fa4 | 27 | this->_pcb = tcp_new(); |
nandgate | 0:6dee052a3fa4 | 28 | tcp_arg(this->_pcb, this); |
nandgate | 0:6dee052a3fa4 | 29 | } |
nandgate | 0:6dee052a3fa4 | 30 | } |