UDP Windows Socket connection HELP!!! 
Author Message
 UDP Windows Socket connection HELP!!!

Hello All

What IM trying to do is Connect to a server using UDP.

I hoping on using the CAsyncSocket class to achieve this.
Opening up a TCP connection, I have no problems here, Its just Ive never
used UDP in Visual C++ .

Oh and it must be compatible with a project created with the MFC AppWizard.

So if anyone can help please let me know.

Thanks in advance
Paul Kirby



Wed, 14 Apr 2004 02:10:43 GMT  
 UDP Windows Socket connection HELP!!!
I think I have sorted it out.

m_pSocket = new CClientSocket(this);
 char IpBuf[1024];
 sprintf(IpBuf,"String to send");
 AfxMessageBox(IpBuf);
 if (!m_pSocket->Create(0,SOCK_DGRAM,FD_READ | FD_WRITE | FD_OOB | FD_ACCEPT
| FD_CONNECT | FD_CLOSE))
 {
  delete m_pSocket;
  m_pSocket = NULL;
  exit(1);
 }
 else
 {
  m_pSocket->SendTo(IpBuf,strlen(IpBuf), PORT , IPADDRESS ,0);

 }

This seems to work ok so far. But if anyone can tell me an easier way to do
it then please let me know.

Thanks in advance
Paul Kirby


Quote:
> Hello All

> What IM trying to do is Connect to a server using UDP.

> I hoping on using the CAsyncSocket class to achieve this.
> Opening up a TCP connection, I have no problems here, Its just Ive never
> used UDP in Visual C++ .

> Oh and it must be compatible with a project created with the MFC
AppWizard.

> So if anyone can help please let me know.

> Thanks in advance
> Paul Kirby



Wed, 14 Apr 2004 04:29:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. UDP Socket Win32 Help

2. Help: UDP Socket question

3. windows socket connection

4. windows socket connection status

5. windows socket connection

6. How to Close Local Tcp/Udp Connection?

7. Close a UDP socket

8. Q: Writing UDP Socket in C...

9. udp socket

10. UDP Datagram sockets

11. UDP Socket question

12. TCP/UDP sockets in Visual C++.

 

 
Powered by phpBB® Forum Software