Click here to Skip to main content
15,891,253 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can i use many modal dialog without main Window Pin
Gary R. Wheeler19-Feb-06 4:32
Gary R. Wheeler19-Feb-06 4:32 
Questionpermutations and combination Pin
RockyJames18-Feb-06 7:47
RockyJames18-Feb-06 7:47 
AnswerRe: permutations and combination Pin
theprinc18-Feb-06 8:16
theprinc18-Feb-06 8:16 
GeneralRe: permutations and combination Pin
RockyJames18-Feb-06 8:21
RockyJames18-Feb-06 8:21 
AnswerRe: permutations and combination Pin
Koushik Biswas18-Feb-06 14:23
Koushik Biswas18-Feb-06 14:23 
Questionurgent: to list names of all the computers on a network Pin
rohini sharma18-Feb-06 7:34
rohini sharma18-Feb-06 7:34 
AnswerRe: urgent: to list names of all the computers on a network Pin
Dan McCormick18-Feb-06 9:37
Dan McCormick18-Feb-06 9:37 
GeneralRe: urgent: to list names of all the computers on a network Pin
rohini sharma19-Feb-06 6:23
rohini sharma19-Feb-06 6:23 
Thanx Dan,
I have tried it but it gives the following error:

error C2065: 'getnameinfo' : undeclared identifier

Complete code of the .cpp file is :

<br />
<br />
#include "stdafx.h"<br />
#include "th1.h"<br />
#include "SockOLN.h"<br />
#include "OnLineNodes.h"<br />
<br />
#ifdef _DEBUG<br />
#define new DEBUG_NEW<br />
#undef THIS_FILE<br />
static char THIS_FILE[] = __FILE__;<br />
#endif<br />
<br />
CSockOLN::CSockOLN()<br />
{<br />
}<br />
<br />
CSockOLN::~CSockOLN()<br />
{<br />
}<br />
<br />
#if 0<br />
BEGIN_MESSAGE_MAP(CSockOLN, CAsyncSocket)<br />
	//{{AFX_MSG_MAP(CSockOLN)<br />
	//}}AFX_MSG_MAP<br />
END_MESSAGE_MAP()<br />
#endif	// 0<br />
<br />
void CSockOLN::OnConnect(int nErrorCode) <br />
{<br />
	 AfxMessageBox("Connected");<br />
	 int i,pos1,pos2;<br />
	 BYTE a1,a2,a3,a4;<br />
	 struct sockaddr_in s;<br />
	 struct in_addr ad;<br />
	 char* hostn,*sern;<br />
	 CString st;<br />
	 UINT po;<br />
	 GetPeerName(st,po);<br />
	 s.sin_family = AF_INET;<br />
	 pos1=st.Find('.',0);	<br />
	 a1=atoi((LPCTSTR)st.Left(pos1));<br />
	 pos2=st.Find('.',pos1+1);	<br />
	 a2=atoi((LPCTSTR)st.Mid(pos1+1,pos2));<br />
	 pos1=st.Find('.',pos2+1);	<br />
	 a3=atoi((LPCTSTR)st.Mid(pos2+1,pos1));<br />
	 pos2=st.Find('.',pos1+1);	<br />
	 a4=atoi((LPCTSTR)st.Mid(pos1+1,pos2));<br />
	 ad.S_un.S_un_b.s_b1 =a1;<br />
	 ad.S_un.S_un_b.s_b2 =a2;<br />
	 ad.S_un.S_un_b.s_b3 =a3;<br />
	 ad.S_un.S_un_b.s_b4 =a4;<br />
	 s.sin_addr = ad;<br />
	 s.sin_port = po;<br />
	 hostn=new char[20];<br />
	 sern=new char[20];<br />
	 getnameinfo(&s,sizeof(s),hostn,20,sern,20,NI_NAMEREQD);<br />
	 ((COnLineNodes*)DialPar)->m_List.AddString(st);<br />
	 ((COnLineNodes*)DialPar)->m_List.AddString(hostn);<br />
	 Close();<br />
	 CAsyncSocket::OnConnect(nErrorCode);<br />
}<br />
<br />
void CSockOLN::listen()<br />
{<br />
	Create(3000);<br />
	Listen();<br />
}<br />
<br />
void CSockOLN::OnAccept(int nErrorCode) <br />
{<br />
	AfxMessageBox("Connection Accepted");<br />
	CAsyncSocket::OnAccept(nErrorCode);<br />
}<br />
<br />
void CSockOLN::SetSockPar(CDialog *d)<br />
{<br />
	DialPar=d;<br />
}<br />
<br />

kindly reply soon.
AnswerRe: urgent: to list names of all the computers on a network Pin
Dan McCormick19-Feb-06 7:31
Dan McCormick19-Feb-06 7:31 
GeneralRe: urgent: to list names of all the computers on a network Pin
rohini sharma20-Feb-06 6:56
rohini sharma20-Feb-06 6:56 
GeneralRe: urgent: to list names of all the computers on a network Pin
Dan McCormick20-Feb-06 7:21
Dan McCormick20-Feb-06 7:21 
QuestionHow to set file filter? Pin
xyhan18-Feb-06 6:57
xyhan18-Feb-06 6:57 
AnswerRe: How to set file filter? Pin
David Crow18-Feb-06 7:02
David Crow18-Feb-06 7:02 
QuestionUpdate Message in system tray Pin
Atif Farooq18-Feb-06 2:27
Atif Farooq18-Feb-06 2:27 
AnswerRe: Update Message in system tray Pin
Michael Dunn18-Feb-06 5:28
sitebuilderMichael Dunn18-Feb-06 5:28 
GeneralRe: Update Message in system tray Pin
Atif Farooq24-Feb-06 12:35
Atif Farooq24-Feb-06 12:35 
QuestionChange hard-coded variables from Outside Pin
RedDragon2k18-Feb-06 2:09
RedDragon2k18-Feb-06 2:09 
AnswerRe: Change hard-coded variables from Outside Pin
David Crow18-Feb-06 6:58
David Crow18-Feb-06 6:58 
AnswerRe: Change hard-coded variables from Outside Pin
jc0dex18-Feb-06 15:49
jc0dex18-Feb-06 15:49 
QuestionLinux Pin
Hamid_RT18-Feb-06 1:55
Hamid_RT18-Feb-06 1:55 
AnswerRe: Linux Pin
Nemanja Trifunovic18-Feb-06 14:28
Nemanja Trifunovic18-Feb-06 14:28 
QuestionCommunicating with services Pin
Anorexic Tribble18-Feb-06 1:52
Anorexic Tribble18-Feb-06 1:52 
AnswerRe: Communicating with services Pin
George L. Jackson18-Feb-06 2:53
George L. Jackson18-Feb-06 2:53 
QuestionDelphi Pascal to C++ Pin
hutt18-Feb-06 1:49
hutt18-Feb-06 1:49 
AnswerRe: Delphi Pascal to C++ Pin
Michael Dunn18-Feb-06 5:33
sitebuilderMichael Dunn18-Feb-06 5:33 

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.