LevyDee 2 Posting Whiz in Training

I'm working on a chat server/client program. So far Ive gotten to where I am by using examples and using msdn. So my problem now is getting my client to properly connect to my server. When I run my server and locally connect through telnet on my computer, it runs perfectly fine and I can send a message etc... When I try to connect my client, the server receives the proper IP as if it is connected, but then my client throws out that an error has occurred via AfxMessageBox. This is all in MFC, so theres no way I can post the entire project, but Ill post the significant code.

This is my OnAccept function for my server. This works fine, and Ive tested it by connecting to it from a computer over the internet. Everything with this is fine.

void serverDlg::OnAccept()
{
	CString StrIP;
	UINT port;

	if(m_sListener1.Accept(m_sConnected))
	{
		m_sConnected.GetSockName(StrIP, port);
		m_sConnected.Send("Klutch Server", strlen("Klutch Server"));		
		
		if(ipConnections == "None")
		{
			UpdateData(1);/////////////
			ipConnections = StrIP;
			UpdateData(0);/////////////
		}else
		{
			UpdateData(1);////////////
			ipConnections += "   " + StrIP;
			UpdateData(0);////////////
		}
	}else
	{
		AfxMessageBox("Unable to accept connection");
	}



}

And this is my client

void clientDlg::OnConnectBtn()
{
	UpdateData(1);///////////////////
	m_sConnected.Create();

	CString hhh = "/*ommited for forums*/";

	if(m_sConnected.Connect(hhh, 2000) == FALSE)
	{
		AfxMessageBox("Could not connect to server");
		m_sConnected.Close();
		return;
	}

	statusUpdate = "Connected";
	UpdateData(0);///////////////////

	ConnectButton.EnableWindow(0);
	DisconnectButton.EnableWindow(1);

}

So the client properly connects to my server, but the error afxmessagebox still happens. So something is not working as expected. Thanks for anyone who has taken the time to look through this =D.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.