Multihreading UDP Socket Server 
Author Message
 Multihreading UDP Socket Server

Hello

I have the follow implementation for a UDP Socket Server (Socket 2.0):

while(TRUE)
{
socket=socket(AF_INET, SOCK_DGRAM, 0);

bind(....);

recvfrom(....);

connect(....);

send(....);

closesocket(....);

Quote:
}

The function send() sends a 5 MB File. A this time the Server can't accept
another connection on this socket because it is busy with send();

When a request comes in, I would like to recall quick recvfrom(), while
send() is doing his job.

It is possible to do this with multithreading (without MFC)?

Thanks for help me and sorry for my bad english.

Roberto Rotondo

This message was also posted in "microsoft.public.de.vc" for german speeking
people.



Sat, 18 Jun 2005 06:35:28 GMT  
 Multihreading UDP Socket Server

Quote:

> Hello

> I have the follow implementation for a UDP Socket Server (Socket 2.0):

> while(TRUE)
> {
> socket=socket(AF_INET, SOCK_DGRAM, 0);

> bind(....);

> recvfrom(....);

> connect(....);

> send(....);

> closesocket(....);
> }

> The function send() sends a 5 MB File. A this time the Server can't accept
> another connection on this socket because it is busy with send();

Well, you should not use UDP to send a file unless you have added error
detection (missed, duplicated or out of order packets) and correction (resend,
duplicate removal, reordering) to your own protocol. TCP is normally better to
use for file transfers.

Quote:
> When a request comes in, I would like to recall quick recvfrom(), while
> send() is doing his job.

> It is possible to do this with multithreading (without MFC)?

Yes, you can use threads without MFC.

Quote:
> Thanks for help me and sorry for my bad english.

> Roberto Rotondo

> This message was also posted in "microsoft.public.de.vc" for german speeking
> people.

Phil Frisbie, Jr.
Hawk Software
http://www.hawksoft.com


Sat, 18 Jun 2005 08:23:25 GMT  
 Multihreading UDP Socket Server

Quote:
> Well, you should not use UDP to send a file unless you have added error
> detection (missed, duplicated or out of order packets) and correction
(resend,
> duplicate removal, reordering) to your own protocol. TCP is normally
better to
> use for file transfers.

Yes Phil... it's much better to use TCP for sending files. But the
requesting client do this in TFTP so I must use UDP.

In fact my own send() function has error detection (missed, duplicated or
out of order packets). The code published here are shown just simplified for
easy unterstanding.

Best wishes

Roberto Rotondo



Sat, 18 Jun 2005 13:27:04 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Close a UDP socket

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

3. udp socket

4. UDP Datagram sockets

5. UDP Socket question

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

7. Broadcast over UDP socket

8. UDP socket and InstallShield???

9. UDP sockets - How to read data?

10. UDP Socket Win32 Help

11. UDP sockets samples?

12. UDP Windows Socket connection HELP!!!

 

 
Powered by phpBB® Forum Software