Click here to Skip to main content
15,921,113 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Name of the '|' key ? Pin
Chris Meech16-Oct-03 5:45
Chris Meech16-Oct-03 5:45 
AnswerRe: Name of the '|' key ? Pin
David Crow16-Oct-03 6:52
David Crow16-Oct-03 6:52 
GeneralRe: Name of the '|' key ? Pin
Anonymous16-Oct-03 7:51
Anonymous16-Oct-03 7:51 
AnswerRe: Name of the '|' key ? Pin
RChin17-Oct-03 6:34
RChin17-Oct-03 6:34 
GeneralVK_TAB in an edit control in a dialog Pin
Dave_16-Oct-03 5:03
Dave_16-Oct-03 5:03 
GeneralRe: VK_TAB in an edit control in a dialog Pin
igor196016-Oct-03 7:50
igor196016-Oct-03 7:50 
GeneralRe: VK_TAB in an edit control in a dialog Pin
Dave_16-Oct-03 8:02
Dave_16-Oct-03 8:02 
GeneralSocket Programming : connecting to server Pin
Cyberizen16-Oct-03 5:02
Cyberizen16-Oct-03 5:02 
hello ppl
i am a newbie to socket programming i am having problems in connecting a client to a server. This is what my SERVER code looks like :

int MainFrame ::OnCreate(LPCREATESTRUCT lpcs)
{

if(!AfxSocketInit())
MessageBox("Socket init error");
//create the server first
if(server.Create(1000,SOCK_STREAM))
MessageBox("Server Socket Created");

CWnd::SetTimer(1,1000,0);
return CWnd::OnCreate(lpcs);
}
void MainFrame::OnTimer(UINT nIDEvent)
{
if(!server.Listen())
MessageBox("Server not responding");

CWnd::OnTimer(nIDEvent);
}

What this code tries to do is that it creates a server on PORT 1000 and listens for incoming connections after each second

now the second part that is the CLIENT has the following code

int MainFrame ::OnCreate(LPCREATESTRUCT lpcs)
{

if(!AfxSocketInit())
MessageBox("Socket init error");
if(client.Create(2000,SOCK_STREAM))
MessageBox("Client Socket Created");
return CWnd::OnCreate(lpcs);
}
void MainFrame ::OnConnect()
{
while(client.Connect("172.16.64.89",1000) != TRUE )
client.Connect("172.16.64.89",1000);
MessageBox("Connected to Server");
}

Everything goes fine here except when i am trying to listen to the server using Connect it never suceeds

please help me out whats wrong with my code what modifications are to be made will be very much thankful

Regards
Cyberizen
GeneralRe: Socket Programming : connecting to server Pin
script_smiths16-Oct-03 22:23
script_smiths16-Oct-03 22:23 
GeneralPrinting Landscape on Windows 2000 Pin
Jonathan Craig16-Oct-03 5:00
Jonathan Craig16-Oct-03 5:00 
GeneralRe: Printing Landscape on Windows 2000 Pin
Steve S16-Oct-03 5:26
Steve S16-Oct-03 5:26 
GeneralDaylight saving problems when using winapi's timezone functions. Pin
Patric_J16-Oct-03 4:56
Patric_J16-Oct-03 4:56 
GeneralRe: Daylight saving problems when using winapi's timezone functions. Pin
Patric_J20-Oct-03 7:40
Patric_J20-Oct-03 7:40 
GeneralCShellFileOp Pin
Kevin Marren16-Oct-03 3:53
Kevin Marren16-Oct-03 3:53 
GeneralRe: CShellFileOp Pin
David Crow16-Oct-03 6:54
David Crow16-Oct-03 6:54 
GeneralFILE Pin
hph16-Oct-03 3:51
hph16-Oct-03 3:51 
GeneralRe: FILE Pin
David Crow16-Oct-03 6:57
David Crow16-Oct-03 6:57 
GeneralSoftware analysis tools Pin
Shay Harel16-Oct-03 3:42
Shay Harel16-Oct-03 3:42 
GeneralClistBox problem here........help!!!!! :-( Pin
Steve Obbayi16-Oct-03 3:31
professionalSteve Obbayi16-Oct-03 3:31 
GeneralRe: ClistBox problem here........help!!!!! :-( Pin
Rafael Fernández López16-Oct-03 9:39
Rafael Fernández López16-Oct-03 9:39 
GeneralRe: ClistBox problem here........help!!!!! :-( Pin
Mike Danberg16-Oct-03 10:01
Mike Danberg16-Oct-03 10:01 
GeneralRe: ClistBox problem here........help!!!!! :-( Pin
Steve Obbayi16-Oct-03 19:07
professionalSteve Obbayi16-Oct-03 19:07 
GeneralCComboBox Pin
De Nardis Andrea16-Oct-03 3:29
De Nardis Andrea16-Oct-03 3:29 
GeneralRe: CComboBox Pin
David Crow16-Oct-03 7:07
David Crow16-Oct-03 7:07 
GeneralRe: CComboBox Pin
De Nardis Andrea16-Oct-03 8:04
De Nardis Andrea16-Oct-03 8:04 

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.