Click to See Complete Forum and Search --> : Chatting


poorni
April 6th, 2004, 07:51 AM
Hi all,
hope everybody is dng fine....i have a doubt actually i am trying to simulate chatting between two machnies within same LAN using MFC.its like i will get the computer name to which the user want to chat.Now after this is there any method to get the IP address of this machine and then establish communication with it?
plz help me

Thanks in advance
Poorni

Andreas Masur
April 6th, 2004, 08:01 AM
[Moved thread]

Amit Sebiz
April 6th, 2004, 08:09 AM
Check out the following articles (http://www.codeguru.com/Cpp/I-N/internet/chatprograms/).

:wave:
Amit

Sam Hobbs
April 6th, 2004, 03:59 PM
To answer your direct question, I think gethostbyname will do what you asked.

Mathew Joy
April 8th, 2004, 05:39 AM
Please keep similar questions in the same thread.


You can use the API gethostbyname() to get the ip.

To establish connection, you can use socket() and related functions (WinSock programming). However you have to do some learning before you start to write. Codes and tutorials are there in the web. You can search this forum itself. A good site ishere. (http://tangentsoft.net/wskfaq/)

dimm_coder
April 8th, 2004, 05:44 AM
If it's considered to use tcp/ip communication, U should look at the following functions:
socket(), connect(), send(), etc.
For UNIX system read man pages for them.
For Win, there's a good overview here: http://www.tangentsoft.net/wskfaq/
in additon to documentation in MSDN (serach for winsock).

There's a lot of other tutorials via the Web, just search.

Andreas Masur
April 8th, 2004, 06:26 AM
[Merged threads]

Andreas Masur
April 8th, 2004, 06:27 AM
To get the IP

How to get the local IP address(es)? (http://www.codeguru.com/forum/showthread.php?s=&threadid=233261)

In general

Winsock Programmer's FAQ (http://www.tangentsoft.net/wskfaq/)

TheCPUWizard
April 8th, 2004, 07:56 AM
Content deleted by author. Not appropriate after threads were merged.

Andreas Masur
April 8th, 2004, 11:32 AM
[Merged threads]



Poorni, please stop creating new threads for the same question. Thank you very much.

poorni
April 13th, 2004, 12:17 AM
hi all,
Thanks for the info u all have given me for the previous messages.Now the chatting application i have tried is working fine in one machine i.e.. the same application can act as server and also client.I first have to run the server and made to wait in Listen mode ,then i will run the second instance of the program which acts as client and it communicates with the server which is listening and then data can be exchanged between the applications .Now the same application with server running in one machine and client in another machine is not working i.e i couldnt establish connection between the two.Now Can anyone tell me the port number thru which we can communicate with another machine.I am using port no.4000.Plz help me

Thanks in advance,
Poorni

Andreas Masur
April 13th, 2004, 04:02 AM
Well...there are some ports in the lower range (< 1025 or similar) which you should not use. However, 4000 should not make a problem. Nevertheless, just to make sure...the number must be the same for the server and client...

poorni
April 13th, 2004, 05:09 AM
hi all,
Thanks for all of ur help.Now my chat program is working.Expecting the same kind of reply from u people in future also.

Thanks
Poorni