Python Forum
I may need some testing / review help with socket server exercise
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I may need some testing / review help with socket server exercise
#1
Hi Friends!

Briefly: here is the exercise I've created couple days ago but for which I feel my skills are not adequate to test it properly, thus any remarks on the statement flaws, probable errors or hacks, deficiencies, issues with automated check - are welcome (and most wished for).

Longer story:

It so happened that recently I worked in a company where people were working on some automated testing system for students (job candidates) and I participated in a discussion where managers quarreled with programmers because testing exercises were too "remote" from "practical needs".

Now it happened so that I myself run this small site with coding problems for some years and I felt this reproach is correct. I tried to recollect some interview questions or test projects I met in my career and at last decided on this one. In my idea the user (student) is to create code to listen both UDP and TCP simultaneously. In my opinion this requires multithreading (but perhaps this is wrong?) - and here is a small catch when testing code opens two connections
one after another but tries to exchange the data on the second of them first (in my opinion this should stuck with single-threaded TCP server).

You see, regretfully I am not much in Python - actually I thought about this very small exercise perhaps for a week or more - despite the checking code (which runs in separate thread (daemon) is perhaps 20 lines and my "reference" solution for the server about another 20 lines.
Reply
#2
Hi there,

It sounds like you've put a lot of thought into creating this exercise! Here are a few insights and suggestions based on your description:

Exercise Scope: Creating a program to listen to both UDP and TCP simultaneously is indeed a practical exercise, especially in network programming. You're right that this typically involves multithreading or asynchronous programming to handle concurrent connections effectively.

Multithreading vs. Asynchronous: While multithreading can work for handling multiple connections, asynchronous programming (using libraries like asyncio in Python) is another approach that's increasingly common and efficient for such tasks. It might be worth exploring both approaches or mentioning that in your exercise.

Testing Approach: To ensure your exercise is robust, consider testing it thoroughly with various scenarios, including edge cases and errors that might occur during network communication. Automated tests can help validate the correctness and performance of the solutions students submit.

Feedback and Iteration: Encourage participants to provide feedback on the exercise. This can help you refine it further and address any unclear instructions or potential pitfalls that arise during testing.

Learning Resources: Provide references or links to additional resources on multithreading, network programming, and best practices in Python. This can enrich the learning experience for students tackling your exercise.

Overall, it's great to see your enthusiasm for improving the practical relevance of coding exercises. Keep iterating based on feedback and your own learning journey in Python!
Reply
#3
Mixing UDP and TCP handling is a practical challenge, especially when testing networking skills. Multithreading does seem like a reasonable approach to handle both simultaneously, but async programming might also be worth considering in Python, given its strengths in managing I/O operations.
Reply
#4
Hi Friends, thanks for answers. There was some feedback already, as couple days ago one of the users identified small bug which made some confusion and since then there are several solutions as I see.

Quote: but async programming might also be worth considering in Python,

Do you mean handling a list of sockets and checking in a loop which of them has some data to be processed etc, without spawning dedicated thread for each?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020