]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/socket.cpp
Moved code around preparing the sorted model.
[wxWidgets.git] / src / common / socket.cpp
index 7285254c4b11971e29f607cecdb886564b5eaad6..05f337bfc370080d6a159340fe1cc35f3ac183bd 100644 (file)
@@ -1203,13 +1203,14 @@ bool wxSocketBase::SetOption(int level, int optname, const void *optval,
     return true;
 }
 
-bool wxSocketBase::SetLocal(wxSockAddress& local)
+bool wxSocketBase::SetLocal(wxIPV4address& local)
 {
   GAddress* la = local.GetAddress();
 
+  // If the address is valid, save it for use when we call Connect
   if (la && la->m_addr)
   {
-    m_socket->SetLocal(la);
+    m_localAddress = local;
 
     return true;
   }
@@ -1274,6 +1275,12 @@ bool wxSocketClient::DoConnect(wxSockAddress& addr_man, wxSockAddress* local, bo
     m_socket->SetReusable();
   }
 
+  // If no local address was passed and one has been set, use the one that was Set
+  if (!local && m_localAddress.GetAddress())
+  {
+    local = &m_localAddress;
+  }
+
   // Bind to the local IP address and port, when provided
   if (local)
   {