• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Quickest way to implement UDP Client/Server

Gamingphreek

Lifer
Mar 31, 2003
11,679
0
81
**Please don't provide any direct code as this is HW. Hints/Advice is welcome, but nothing else**

I have a Network Architecture Programming project due on Sunday night and, given my extreme case of Senioritis ;), I've waited until right now to start.

We can write the client and server in any language, but I'm actually torn between POSIX C++ and Java.

We are pretending that the data transfer is reliable and that it needs to simply transfer a file of up to 1GB in size.

The next assignment will be to multi-thread the code, so thread safe functions and the ease of multi-threading is preferred.

My question is, which language would this be easiest and fastest to do this in? I'm thinking Java given its Multi-threaded support and high level sockets() API.

I've made a telnet/curl server in C that supported HTTP/1.1 (Concurrent threads using fork(), and persistent connections). Should this be similar to that for the most part? I don't see this project taking very long at all (at most a few hours - would I be vastly oversimplifying something?)

Thanks,
-Kevin

Edit: Heck thinking about this, it should only take about 50 lines and a couple minutes to get it working (In Java) unless I'm way way off base.
 
Last edited:

EagleKeeper

Discussion Club Moderator<br>Elite Member
Staff member
Oct 30, 2000
42,589
5
0
If you are in school - your time factor is off by at least an order of magnitude. Something will not work and you will not have your error handling logic properly implimented
 

Gamingphreek

Lifer
Mar 31, 2003
11,679
0
81
I actually think I completely finished it in Java.

I had trouble testing it as I had a bug. Java's errors aren't as each to trace in gdb or valgrind as C/C++. Turns out I misunderstood what the offset was in the some of the I/O - stupid error really.

The MTU is set for 500 bytes. I've successfully transmitted multiple MB files from point A to point B and calculated the time and transfer rate.

I sent an E-Mail to my instructor to make sure that I produced what he wants (I may not have layered it enough to create a robust protocol - so I may need to add a couple things).

-Kevin
 

esun

Platinum Member
Nov 12, 2001
2,214
0
0
Sounds like you figured it out (and I would've recommended Java as you chose).

I just wanted to mention that fork() produces processes, not threads.
 

Gamingphreek

Lifer
Mar 31, 2003
11,679
0
81
Sounds like you figured it out (and I would've recommended Java as you chose).

I just wanted to mention that fork() produces processes, not threads.

Whoops, my mistake there :)

Working in Java was a lot faster/easier. I don't have to worry about calling bind() and fork() appropriately - It's all abstracted away. I created a C based server that is ready to go as well, I just would need to do some slight modifications as it is an HTTP server right now.