@@ -254,17 +254,10 @@ int errNo = 0; if (_socket != INVALID_SOCKET) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; - _listening = false; - - /* Make sure to clear the read buffer in case the socket is reused */ - [self freeMemory: _readBuffer]; - _readBuffer = NULL; - _readBufferLength = 0; - if (_SOCKS5Host != nil) { /* Connect to the SOCKS5 proxy instead */ host = _SOCKS5Host; port = _SOCKS5Port; } @@ -664,6 +657,21 @@ errNo: of_socket_errno()]; return v; } #endif + +- (void)close +{ + _listening = false; + + [self freeMemory: _address]; + _address = NULL; + _addressLength = 0; + +#ifdef OF_WII + _port = 0; +#endif + + [super close]; +} @end