Click here to Skip to main content
15,917,951 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionC++ Winsock Cli/Svr hostname/address Pin
managetao228-Oct-07 14:44
managetao228-Oct-07 14:44 
I apologize in advance for not posting code, but it would have required the whole "server.cpp" and "clinent.cpp" files, so I reference their URLs at MSDN. I think my question is quite specific; however. Where do I pass the hostname/address parameters? I have tried many locations replacing references, etc with localhost or 127.0.0.1.

Using the MSDN sample client/server code I cannot find where to input the server name/address
argument/parameters. Both the client and the server compile fine.

The server is supposed to receive data from the client and echo it back to the client. In this case both client and server run on the same machine and I believe should use server name or address as localhost or "127.0.0.1".

The Server code can be found at:
http://msdn2.microsoft.com/en-us/library/aa922634.aspx

When I run it I get this message which looks OK, accept I always get odd
characters for type:
"Socket 0x0012f8d8 ready for connection with ╕ ↕ family, öq╜Θê↓╚☺ type, on port"

The Client code can be found at:
http://msdn2.microsoft.com/en-us/library/aa916685.aspx

When I run the client I get this message:
"Server name/address parameter required. Ex: clnt 123.45.67.89
Press any key to continue . . ."

I am not sure (1) where to place the host address
argument, and (2) if it needs to be just passed from the
client side or both.

I have tried placing variations of 127.0.0.1, "127.0.0.1", localhost, "localhost" in various
locations such as "getaddrinfo" area, etc. but I still get the clinet asking for sever parameters or get build errors.

Again, my question is where/how do I tell the client how to reach the server (pass server parameters) and/or do I need to do the same for the server to reach the client for echo returns?

Thanks much

mt
AnswerRe: C++ Winsock Cli/Svr hostname/address Pin
jhwurmbach28-Oct-07 23:42
jhwurmbach28-Oct-07 23:42 
QuestionDoing N-Up Printing programatically Pin
Bauxinator28-Oct-07 11:20
Bauxinator28-Oct-07 11:20 
QuestionRe: Doing N-Up Printing programatically Pin
Nelek28-Oct-07 23:42
protectorNelek28-Oct-07 23:42 
AnswerRe: Doing N-Up Printing programatically Pin
Bauxinator29-Oct-07 0:06
Bauxinator29-Oct-07 0:06 
GeneralRe: Doing N-Up Printing programatically Pin
Nelek29-Oct-07 0:20
protectorNelek29-Oct-07 0:20 
GeneralRe: Doing N-Up Printing programatically Pin
Bauxinator29-Oct-07 0:36
Bauxinator29-Oct-07 0:36 
GeneralRe: Doing N-Up Printing programatically Pin
Nelek29-Oct-07 1:29
protectorNelek29-Oct-07 1:29 
GeneralRe: Doing N-Up Printing programatically Pin
Bauxinator29-Oct-07 2:29
Bauxinator29-Oct-07 2:29 
AnswerRe: Doing N-Up Printing programatically Pin
She_Jack6-Jul-10 22:59
She_Jack6-Jul-10 22:59 
GeneralRe: Doing N-Up Printing programatically Pin
Bauxinator7-Jul-10 7:22
Bauxinator7-Jul-10 7:22 
GeneralRe: Doing N-Up Printing programatically Pin
She_Jack11-Jul-10 22:45
She_Jack11-Jul-10 22:45 
GeneralRe: Doing N-Up Printing programatically Pin
Bauxinator11-Jul-10 22:59
Bauxinator11-Jul-10 22:59 
QuestionRestarting Windows Pin
RomTibi28-Oct-07 9:47
RomTibi28-Oct-07 9:47 
AnswerRe: Restarting Windows Pin
Garth J Lancaster28-Oct-07 10:30
professionalGarth J Lancaster28-Oct-07 10:30 
GeneralRe: Restarting Windows Pin
RomTibi29-Oct-07 6:28
RomTibi29-Oct-07 6:28 
AnswerRe: Restarting Windows Pin
Hamid_RT28-Oct-07 19:09
Hamid_RT28-Oct-07 19:09 
GeneralRe: Restarting Windows Pin
RomTibi29-Oct-07 6:27
RomTibi29-Oct-07 6:27 
GeneralRe: Restarting Windows Pin
Hamid_RT29-Oct-07 7:21
Hamid_RT29-Oct-07 7:21 
GeneralRe: Restarting Windows Pin
ThatsAlok30-Oct-07 1:57
ThatsAlok30-Oct-07 1:57 
GeneralRe: Restarting Windows Pin
RomTibi30-Oct-07 9:00
RomTibi30-Oct-07 9:00 
QuestionNeed help with console character interface Pin
jp-mocs28-Oct-07 9:20
jp-mocs28-Oct-07 9:20 
QuestionReading excel worksheet from clipboard Pin
Andy H28-Oct-07 6:37
Andy H28-Oct-07 6:37 
QuestionUnreacheable subitem prepaint stage. Pin
paper6728-Oct-07 5:36
paper6728-Oct-07 5:36 
QuestionHow to recored and play mp3 files Pin
Mohsen Saad28-Oct-07 0:26
Mohsen Saad28-Oct-07 0:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.