IP Device driver
-
- Aurora
- Posts: 853
- Joined: Tue Dec 17, 2013 1:17 pm
IP Device driver
Now I have a Linux box that I can run UQLX in. I have finally got around to trying my IPBasic extensions in Linux.
I have found quite a few things that don't act as expected, and need to looked into.
But something I have noticed which I am not sure whether it is a bug in either QPC2, or UQLX.
Or something about Windows/Linux.
When I use either IP_GETSOCKNAME$ or IP_GETPEERNAME$. Which returns a SockAddr structure, The 'family' part (a word) value is different.
This is couple of screen dumps from QPC2 and UQLX both running my test program. Note the 'Family' values of 2 and 512. The expected value is 2, but in UQLX it's 512 which is the word value swapped around (big endian/little endian?)
So is this an emulator problem, or an issue with Windows/Linux?
I have also included the test programs. Start two copies of the emulator in one PC, LRESPR IPBasic_cde on each, and run the IPTests(erver) on one, and IPTestc(lient) on the other
I have found quite a few things that don't act as expected, and need to looked into.
But something I have noticed which I am not sure whether it is a bug in either QPC2, or UQLX.
Or something about Windows/Linux.
When I use either IP_GETSOCKNAME$ or IP_GETPEERNAME$. Which returns a SockAddr structure, The 'family' part (a word) value is different.
This is couple of screen dumps from QPC2 and UQLX both running my test program. Note the 'Family' values of 2 and 512. The expected value is 2, but in UQLX it's 512 which is the word value swapped around (big endian/little endian?)
So is this an emulator problem, or an issue with Windows/Linux?
I have also included the test programs. Start two copies of the emulator in one PC, LRESPR IPBasic_cde on each, and run the IPTests(erver) on one, and IPTestc(lient) on the other
- Attachments
-
- IPtests.zip
- (6.62 KiB) Downloaded 92 times
- XorA
- Site Admin
- Posts: 1368
- Joined: Thu Jun 02, 2011 11:31 am
- Location: Shotts, North Lanarkshire, Scotland, UK
Re: IP Device driver
32bit or 64bit uQlx, as we know 64bit still has many undiscovered variables issues due to terrible use of C types in the original source code.
-
- Aurora
- Posts: 853
- Joined: Tue Dec 17, 2013 1:17 pm
Re: IP Device driver
Pretty sure it's 32 bit. It's an old (Celeron?) Dell PC running Xubuntu.XorA wrote:32bit or 64bit uQlx, as we know 64bit still has many undiscovered variables issues due to terrible use of C types in the original source code.
I may make a test, and set a flag in IPBasic to indicate that the family value need to be swapped around when this problem happens. Or is it safe to assume that if the first byte of the family value is not zero, then the family value needs to be swapped? So basically is the family value ever going to be greater than 255?
- NormanDunbar
- Forum Moderator
- Posts: 2278
- Joined: Tue Dec 14, 2010 9:04 am
- Location: Leeds, West Yorkshire, UK
- Contact:
Re: IP Device driver
Please ignore me if I'm talking bollox, again, but, I did some network programming on Unix and Windows back in the mid 1990s and I seem to remember getting back to front values. Have you neglected to call htons, htonl (host to network short/long) or ntohs/ntohl (network to host short/long) to get the socket address detail in the correct format for the host - big or little endian?
These functions: https://linux.die.net/man/3/htons
It might be ok on Linux or Windows on x86 as they are little endian, but the QL is big endian, and it sounds exactly like the problem I had, back then.
Cheers,
Norm.
These functions: https://linux.die.net/man/3/htons
It might be ok on Linux or Windows on x86 as they are little endian, but the QL is big endian, and it sounds exactly like the problem I had, back then.
Cheers,
Norm.
Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Re: IP Device driver
Norman,NormanDunbar wrote:Please ignore me if I'm talking bollox, again, but, I did some network programming on Unix
Not bollocks. But 68k is big-endian and network byte order is big endian - ntohx() and htonx() are no-ops on proper CPUs like the 68k, and you only really need to swap stuff around on systems like the PC. Very probably, the missing byte swap is somewhere in the x86 code.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
- NormanDunbar
- Forum Moderator
- Posts: 2278
- Joined: Tue Dec 14, 2010 9:04 am
- Location: Leeds, West Yorkshire, UK
- Contact:
Re: IP Device driver
Thanks Tobias. I'll make a note, I wasn't talking bollox!
Cheers,
Norm.
Cheers,
Norm.
Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
- NormanDunbar
- Forum Moderator
- Posts: 2278
- Joined: Tue Dec 14, 2010 9:04 am
- Location: Leeds, West Yorkshire, UK
- Contact:
Re: IP Device driver
Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
-
- Aurora
- Posts: 853
- Joined: Tue Dec 17, 2013 1:17 pm
Re: IP Device driver
I'm working in the IP device driver in QDOS, which I don't think support hton and ntoh.NormanDunbar wrote:Please ignore me if I'm talking bollox, again, but, I did some network programming on Unix and Windows back in the mid 1990s and I seem to remember getting back to front values. Have you neglected to call htons, htonl (host to network short/long) or ntohs/ntohl (network to host short/long) to get the socket address detail in the correct format for the host - big or little endian?
These functions: https://linux.die.net/man/3/htons
It might be ok on Linux or Windows on x86 as they are little endian, but the QL is big endian, and it sounds exactly like the problem I had, back then.
Cheers,
Norm.
And from QDOS it might be tricky trying to figure out what the architecture of the underlying system the emulator is running in.
- XorA
- Site Admin
- Posts: 1368
- Joined: Thu Jun 02, 2011 11:31 am
- Location: Shotts, North Lanarkshire, Scotland, UK
Re: IP Device driver
Best thing is if we just fix the uQlx source! We don't want "special" versions just for one emulator when its the easiest one to get fixed! I won't have time probably in the coming couple of weeks but anyone is free to post patch to github!Martin_Head wrote:Pretty sure it's 32 bit. It's an old (Celeron?) Dell PC running Xubuntu.XorA wrote:32bit or 64bit uQlx, as we know 64bit still has many undiscovered variables issues due to terrible use of C types in the original source code.
I may make a test, and set a flag in IPBasic to indicate that the family value need to be swapped around when this problem happens. Or is it safe to assume that if the first byte of the family value is not zero, then the family value needs to be swapped? So basically is the family value ever going to be greater than 255?