Commit Graph

8 Commits (bdc355f873b24251199a015eb5678cb8792385da)

Author SHA1 Message Date
Seppo Takalo 619bcb5b4e Implement Socket::getpeername() API
This is equivalent of POSIX getpeername() function. It allows to
get remote address associated with the socket.
For example:
socket *s = server.accept();
SocketAddress remote;
s->getpeername(&remote);
2018-11-13 11:02:51 +02:00
Marc Emmers dcb97f9f74 InternetSocket: Fixed missing unlock before return 2018-11-06 15:02:42 +01:00
Michal Paszta 0da0f16d60 TCPSocket accept refactored to close cleanly and icetea test added
Private constructor called in TCPSocket accept, when creating a new Socket.
Close() method calls moved "up" to InternetSocket.
InternetSocket::close() returns proper error code when no socket available.
Add TcpSocket::accept icetea tests.
Deleting sockets moved to teardown.
2018-10-26 12:02:25 +03:00
Sławek Piotrowski 9b89ad2fa9 Fix hard-fault when socket created using accept() is closed
When socket created  using accept() is closed by calling the close()
method, "delete this" is executed which triggers the destructor call
on TCPSocket which in turn calls close() once again. Because _stack
is already 0 this results in a hard-fault.

Add a check that skips the rest of the close() method is the _stack
is already 0.
2018-10-06 21:15:29 +02:00
Juha Ylinen b8b39ac3ab netsocket: Fix compiler warning
[Warning] InternetSocket.h@237,10: 'InternetSocket::_factory_allocated' will be initialized after [-Wreorder]
[Warning] InternetSocket.h@236,23:   'volatile unsigned int InternetSocket::_pending' [-Wreorder]
[Warning] InternetSocket.cpp@22,1:   when initialized here [-Wreorder]
2018-08-24 13:26:53 +03:00
Martin Kojtal b46aa6108d netsocket: astyle fix 2018-08-03 13:34:33 +01:00
Seppo Takalo 407b2f275d Move accept() to abstract socket class and implement in TCPSocket
Deprecate TCPServer in favor of just TCPSocket::accept()
2018-06-20 12:38:07 +03:00
Seppo Takalo cdbe43c0d5 Refactor Sockets by moving functions up into common base.
* Move IP Socket stuff to InternetSocket class which is inherited by TCP/UDP
* Implement sendto() and recvfrom() on TCP socket
* Implement connect() call on UDP
* Implement send() and recv() calls on UDP socket
2018-06-20 12:38:06 +03:00