Use 'localhost' directly instead of wxGetHostName, which sometimes does not

do the right thing. This change doesn't affect DDE classes, which ignore this
argument anyway.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@6961 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guillermo Rodriguez Garcia
2000-03-27 19:40:37 +00:00
parent fc478ddb79
commit 387cdaf2f4
2 changed files with 13 additions and 9 deletions

View File

@@ -74,11 +74,14 @@ MyClient *my_client ;
// main frame // main frame
bool MyApp::OnInit() bool MyApp::OnInit()
{ {
wxString server = "4242"; // service name (DDE classes) or port number (TCP/IP based classes)
wxString hostName = wxGetHostName(); wxString service = "4242";
// ignored under DDE, host name in TCP/IP based classes
wxString hostName = "localhost";
if (argc > 1) if (argc > 1)
server = argv[1]; service = argv[1];
if (argc > 2) if (argc > 2)
hostName = argv[2]; hostName = argv[2];
@@ -88,7 +91,7 @@ bool MyApp::OnInit()
// suppress the log messages from MakeConnection() // suppress the log messages from MakeConnection()
{ {
wxLogNull nolog; wxLogNull nolog;
the_connection = (MyConnection *)my_client->MakeConnection(hostName, server, "IPC TEST"); the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, "IPC TEST");
while ( !the_connection ) while ( !the_connection )
{ {
@@ -100,7 +103,7 @@ bool MyApp::OnInit()
return FALSE; return FALSE;
} }
the_connection = (MyConnection *)my_client->MakeConnection(hostName, server, "IPC TEST"); the_connection = (MyConnection *)my_client->MakeConnection(hostName, service, "IPC TEST");
} }
} }

View File

@@ -72,14 +72,15 @@ bool MyApp::OnInit()
// Create the main frame window // Create the main frame window
(new MyFrame(NULL, "Server"))->Show(TRUE); (new MyFrame(NULL, "Server"))->Show(TRUE);
// create the server object // service name (DDE classes) or port number (TCP/IP based classes)
wxString server_name = "4242"; wxString service = "4242";
if (argc > 1) if (argc > 1)
server_name = argv[1]; service = argv[1];
// Create a new server // Create a new server
m_server = new MyServer; m_server = new MyServer;
m_server->Create(server_name); m_server->Create(service);
return TRUE; return TRUE;
} }