Listing all open sockets
Pages: 1 2
Dave Higton (1515) 3534 posts |
I’m thinking that the address should come before the port, not after it. I’m also thinking that the all-zero IPv6 address should be represented as [anyhost], the same as for IPv4 sockets. That means that there would be no way to tell whether a listening socket is IPv4 or IPv6, which means adding another column. |
Steve Pampling (1551) 8172 posts |
I’d agree, it’s the way I normally think about things when working.
I don’t think that’s true. To quote a chunk of your earlier post: Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) ip 0 0 *.49171 *.* ip 0 0 *.32771 *.* ip 0 0 *.137 *.* ip 0 0 *.32770 *.* Active Internet connections (including servers) Proto Recv-Q Send-Q Local Address Foreign Address (state) ip6 0 0 *.443 *.* ip6 0 0 *.80 *.* ip vs. ip6 |
Rick Murray (539) 13850 posts |
I didn’t mean addresses by name, I meant it didn’t give me lots of zeroes. |
David J. Ruck (33) 1636 posts |
All zeros for a local and remote address means an IPv4 listening socket for the given local tcp or udp port number. |
Dave Higton (1515) 3534 posts |
Updated screenshot of work in progress: No guarantee that this picture will remain available – if I delete it, I’ll have to try to remember to delete or edit this post. |
Dave Higton (1515) 3534 posts |
ResRec causes Zeropain logs to be generated. That’s going to be fun to find. |
Steve Pampling (1551) 8172 posts |
Port after IP is more logical, more space required between IP and port perhaps? Or may a dot or colon ?
Does the original version do that? If not, then it’s time to concentrate on the changed items, like the use of the newer Socket_ calls you will have needed to bring in the IPv6 info
Well, there’s zero assembler in the program, so logically it has to be something it calls |
Martin Avison (27) 1494 posts |
That’s going to be fun to find. You do not need assembler in BASIC to risk ZeroPain errors – the usual cause is not something it calls, but indirect accesses to memory … and there are hundreds of those in ResRec! I will try and dig out my notes about coping with the ‘fun’ with BASIC ZeroPains. |
Dave Higton (1515) 3534 posts |
Yes, and it doesn’t appear to be related to sockets – it also happens when I double-click a zip file on a local drive. The result is 128 ZeroPain logs, time stamped to the same second. I can see R0 incrementing from 7 to &86, and R2 incrementing from &8100 to &817F. |
Dave Higton (1515) 3534 posts |
Martin: thanks for ZPdebug, it is proving useful. The errant lines caused by opening files and sockets are very similar. Each contains multiple statements, so the next step is to split them into lines each containing a single statement. The code there does stuff I don’t yet understand, but anyone who wants to look at the original code should look for DEFPROCscanfile and DEFPROCscansocket. |
Dave Higton (1515) 3534 posts |
There’s a condition: IF F% > PAGE AND $(F% + 8) <> A$ THEN It’s sometimes entered with F% = -1. The same condition appears in two functions, and a very similar condition with the same error occurs a bit lower down in one of them. I think I’ve fixed them all now. |
Martin Avison (27) 1494 posts |
Just discovered that here as well … in PROCscanfile. But I have also seen F%=0. There is stuff that I do not understand either :-(( |
Steve Fryatt (216) 2105 posts |
That’s one of the downsides to BASIC… In C (or, indeed, Python and many other languages), that would be a valid way to avoid the NULL dereference, but in BASIC you’d have to do something like
as in BASIC, Personally, I find the BASIC approach a lot less readable, but appreciate that it’s a matter of taste. |
Dave Higton (1515) 3534 posts |
Next significant problem is to improve the window redraw – it doesn’t shrink when the number of lines reduces, and lines can remain there after they’ve closed. |
Dave Higton (1515) 3534 posts |
Steve: I’ve put the conditions into multi-line functions. |
Colin Ferris (399) 1818 posts |
Hmm – Using a pointer as a (yes no) info? |
Steve Pampling (1551) 8172 posts |
It’s sometimes entered with F% = -1. Dumb question, but is there any reason it’s even allowed to enter when F% is less than or equal to zero? Or is this one of those “we ought to check passed parameters, but it works, error free, without the check” (until it doesn’t) situations? |
Dave Higton (1515) 3534 posts |
There is an ELSE too. Clearly, when F% is -1, the IF clause isn’t executed (but the ELSE is), but the interpreter still has to evaluate the rest of the logical expression before deciding the overall condition is FALSE. Martin: your ZPdebug has found why my modified !Printers RunImage file causes ZeroPain errors on startup. It’s a very similar mistake that I wrote into my logging code, which attempts to log an indirected string without first checking that the pointer is valid. Quickly fixed. Thanks again! |
Dave Higton (1515) 3534 posts |
Re. the code that does stuff we don’t understand: I think it’s stuff that could be done with arrays, but the author chose to do it in his own way, managing memory himself. Remember, the original ran in a 32 kiB Wimp slot. Mine doesn’t any more, simply because I’ve undone the compression of the bits I’ve been working on, so as to make them clearer to read. I chose to give it a 64 kiB slot, which should more than account for my fattening. |
Colin Ferris (399) 1818 posts |
Makes Gerfs point of testing small functions the best you can :-) |
Rick Murray (539) 13850 posts |
There, fixed that for you. ;) |
Rick Murray (539) 13850 posts |
Perhaps because the data is liable to change a lot and BASIC doesn’t have dynamic arrays?
Argh! No! That’s double!
If I remember correctly, |
Martin Avison (27) 1494 posts |
Not quite, as that includes the stack. If you use as from ResRec v0.43 – though in this case the stack is small.
|
Colin Ferris (399) 1818 posts |
Ref TV Quest Repair Shop – doing a repair of a Mechanical calculator – times past :-) |
Dave Higton (1515) 3534 posts |
I’ve put version 0.45 on my web site: https://davehigton.me.uk/ Andrew Pullan’s version does not appear to have any copyright or licence statement anywhere, so I believe it’s acceptable for me to release this version. It is unlikely to work on versions of RISC OS prior to 3.7 – if you really are going to continue with such an ancient version of RISC OS, it’s best to stick with Andrew’s version. As usual, please let me know how you get on with it. |
Pages: 1 2