-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
created UCI commands for tcp listener #98
base: master
Are you sure you want to change the base?
Conversation
Also, the crew on the FB channel asked for the port to be configurable. Would you want this maintained in the internal configuration, or sent by my library code? Two things concern me here... 1) you could use more ports later for other things and code needs to exist to prevent the listener from using those ports, and 2) there was mention of possibly accepting multiple connections on the same port. Considering use cases for that. I was only considering a single incoming connection. So didnt know if you wanted to manage the incoming port on the config side, or just allow the developer to pick a port in my library and return a status of fail if its an invalid port from a list or such. |
Works for me - I've just build the complete 1541 U2+ firmware from git master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice proof of concept. Before actually unrolling these changes, let's make some extra steps:
-
Users request multiple connections on a single port. The network stack supports this, but it means that the listening task should remain running even after the connection has been established.
-
There seems to be only one instance now of the listener. Also this listener doesn't have a parameter; the port number cannot be set. How about creating an instance when performing the "start listen socket" command, taking the port as a parameter? Or, manage multiple tasks within one userlistener object, whichever you find more convenient.
-
The commands should return information (success / fail). Also, it is necessary to have some sort of handle to stop the listening, if multiple instances exist. This could be the listening socket number, for example. But you will HAVE to check against a list of started listeners, as you need to make sure that the user does not close a listener socket, which was not a listener socket in the first place.
-
Can you provide a rationale that this code is thread-safe? (I am not saying it is not, but it is part of the design..)
-
What happens in the following scenario:
- User sets up a listening socket
- User 'closes' the listening socket
- User connects to the socket that was just closed
-
As GitHub clearly shows, this code has a mix of tabs and spaces. Please use tab-stop of 4, and convert to spaces, for proper indentation.
Responding to each of the bullet items:
Thanks Gideon. If you can respond back - particularly around the multiple connections, that will get me in the right direction. Again, due to the primary use case of BBSs, I dont really see it worth trying to manage multiples. But if you want to support it anyway just in case, Im happy to take it further. Thanks Scott |
Ok thanks Markus - Ill figure out where its going weird on my side. Edit: Yes it was. Apparently recent changes I didnt have in my master branch. Sorry for that. |
Oh also - I wasnt sure which all Makefiles needed to be updated with the new .cc file for the listener. So I only did the two per this commit. (not sure if some are test ones, etc). Can you help me understand the various targets and what they build for? (in the /target/software directories) |
Hi Scott, Replying to you bullet-wise:
I hope my remarks make sense. Regards, |
Yep all makes sense. Ok will take care of those changes, Thank you! |
I added the port number addition as an incoming parameter to the command, and better status on the listen command. I had an issue when flashing where it would for some reason go to the "out of the box" screen (1st boot) when I flashed it, so I dunno if the code is going left, or if my build is messed up. Im going to switch back to master, and make sure I can build and flash it. |
Yeah, seems there is a problem in building the U64 source. When flashing the master branch, it will go to the "Welcome to the Ultimate 64!" screen, and pressing the button on the side does nothing, requiring a flash via the adapter. Does this need an updated sof file or something in the external directory? |
I'd guess so. Looking at commit d718dd9 you see
and some VHDL code to enable reading reset... There is reason to belive that the same adjustment in the VHDL code is neccessary for the Ultimate 64, so yes - a new .sof should be needed. |
Gideon, could you hook us up with an updated sof file for the U64? Thanks |
Hi Scott... Thank you for your changes. Please allow me some time, as I am a bit busy. I saw that you went all the way through flashing anew with the old firmware, also the old FPGA. If you have a USB Blaster, you can also just start a debug session from Eclipse and step through your code. Wouldn't that be easier? I added the latest FPGA to the repository. This should fix your problem. I wasn't aware of this issue! Thanks. |
Thank you - and with me, take all the time you ever need. Im a software developer by day and can only imagine how busy you might be. Cant thank you enough. |
Ill have to stop here for the moment on handling multiple connections. There is one bug that Im struggling with - even though I close the listener socket, its still bound for some time. This seems to be by design. So youre right - not only does answering the phone the next time become a problem, but killing the task also then has a problem. And adding multiple connections compounds the problem further. Ill continue to see what I can do. |
Demo over at:
https://github.com/xlar54/ultimateii-dos-lib/tree/master/target
the d64 or the individual u-echoserver.prg file
It also handles disconnects without issue.