English Amiga Board

English Amiga Board (https://eab.abime.net/index.php)
-   support.WinUAE (https://eab.abime.net/forumdisplay.php?f=5)
-   -   bsdsocket.library - how does it work? (https://eab.abime.net/showthread.php?t=97804)

Sim085 21 June 2019 01:01

bsdsocket.library - how does it work?
 
Recently (yesterday) I managed to connect my real A1200 to the Internet using a pcmcia card, prism2v2 and roadshow (demo version).

From what I understand prism2v2 is the driver used to manage the pcmcia card and roadshow is the TCP/IP stack. Once I installed these I could browse to google.com.

In WinUAE all I have to do is tick the checkbox bsdsocket.library to get the same result.

So my question is; what does ticking the bsdsocket.library checkbox actually do?
How does the browser still manage to connect to google.com without a TCP/IP stack installed?

alpine9000 21 June 2019 01:42

Bsd socket is the interface to the tcp stack. In UAE that same interface is proxied directly to network calls on the host computer, so no need for a stack on the Amiga.

AMIGASYSTEM 21 June 2019 02:04

With WinUAE you can also disable "bsdsocket.library" and make a connection as you do on a Real Amiga, in this case you have to activate "uaenet. device" and configure a TCP/IP stack with Miami or other similar software.

Sim085 21 June 2019 08:57

Thanks for your answer. Your question made me realize I do not know how the browser hits the TCP/IP stack in the first place. I guess what is confusing me is how bsdsocket works without the need to install anything in Workbench.

Quote:

Originally Posted by alpine9000 (Post 1328417)
Bsd socket is the interface to the tcp stack. In UAE that same interface is proxied directly to network calls on the host computer, so no need for a stack on the Amiga.

This is interesting, didn't know about it. Will try it out :)

Quote:

Originally Posted by AMIGASYSTEM (Post 1328426)
With WinUAE you can also disable "bsdsocket.library" and make a connection as you do on a Real Amiga, in this case you have to activate "uaenet. device" and configure a TCP/IP stack with Miami or other similar software.


Predseda 21 June 2019 09:03

I also met bsdsocket.library requirement recently (yes, it was also for AmiModRadio ;) ), but my question is: is this library a separate file, that can be downloaded and put into LIBS: in my real Amiga, and does it help to anything?

patrik 21 June 2019 09:42

@Predaeda:

As already said, bsdsocket.library is the interface which applications use to talk to the TCP/IP stack - think connect, send, receive etc.

The main executable of for example AmiTCP and Miami creates bsdsocket.library in memory, while in Roadshow it is a file in LIBS: which contains more or less the entire TCP/IP stack.

So there is no separate download, the bsdsocket.library in your system, in whichever way it exists is tightly coupled with the TCP/IP stack you use.

AMIGASYSTEM 21 June 2019 10:22

Quote:

Originally Posted by Sim085 (Post 1328443)
This is interesting, didn't know about it. Will try it out :)

Yes, to be able to do so, however, you need to install on Windows, npcap or WinPcap, I enclose a video of mine that shows the connection Network to the NetSurf with UaeNet.device:


WinUAE + UaeNet.device

Predseda 21 June 2019 10:34

Quote:

Originally Posted by patrik (Post 1328450)
@Predaeda:

As already said, bsdsocket.library is the interface which applications use to talk to the TCP/IP stack - think connect, send, receive etc.

The main executable of for example AmiTCP and Miami creates bsdsocket.library in memory, while in Roadshow it is a file in LIBS: which contains more or less the entire TCP/IP stack.

So there is no separate download, the bsdsocket.library in your system, in whichever way it exists is tightly coupled with the TCP/IP stack you use.


Ah, thank you. I am asking because I tried this: I launched Miami and connected to the internet. Then I started snoopdos, RexxMast and launched AmiModRadio. And in SnoopDOS log there was something like "attempting to load bsdsocket.library: FAIL". So I though it is missing in my system, but in meanwhile it should be in RAM?

patrik 21 June 2019 13:12

With Miami it is in RAM. You can verify that it is available by “version bsdsocket.library” in a shell. Double check that the version reported in the shell is equal or greater than the version SnoopDos logs that AmiModRadio attempts to open.

Phantasm 28 June 2019 16:18

bsdsocket.library is the primary way that all amiga applications interface with the network.


If you install a tcp/ip stack you will find that the stack creates a bsdsocket.library (in memory) and you can see it using the version command.


WinUAE has the option to enable the bsdsocket.library which creates a compatible bsdsocket.library in memory which talks to the network on the PC side using the same api calls.

patrik 28 June 2019 21:50

@Phantasm:

Regarding the in-memory-creation of bsdsocket.library, Roadshow is an exception to that and most of the stack resides in the file LIBS:bsdsocket.library.

McTrinsic 29 June 2019 00:30

Any chance to dump a lib from ram to use it maybe later as a file?

Hewitson 29 June 2019 02:46

Quote:

Originally Posted by McTrinsic (Post 1329746)
Any chance to dump a lib from ram to use it maybe later as a file?

You could, but what are you going to do with the library? It is absolutely useless without a TCP/IP stack.

Sim085 29 June 2019 08:53

Let me see if I understand, bsdsocket.library is the library used by other applications to access the TCP/IP stack.

In case of WinUAE (bsdsocket.library ticked), the bsdsocket.library is injected into the memory of the guest emulation, where other applications find this, and calls to this are mapped to the TCP/IP stack of the host operating system.

(the following part I am not so sure about)
In case of non-emulation there is still a bsdsocket.library but this time rounds any call to this is mapped to the TCP/IP stack installed (ex: Roadshow, or Miami).

Is the above correct?

Quote:

Originally Posted by Hewitson (Post 1329753)
You could, but what are you going to do with the library? It is absolutely useless without a TCP/IP stack.


Hewitson 29 June 2019 09:44

In the case of non-emulation, the bsdsocket.library is generally created in memory by the TCP/IP stack. They do not come with this library as a seperate file. WinUAE simply emulates the behaviour of the stack, creating it's own bsdsocket.library replacement.

thomas 29 June 2019 10:45

Quote:

Originally Posted by Sim085 (Post 1329764)
In case of non-emulation there is still a bsdsocket.library but this time rounds any call to this is mapped to the TCP/IP stack installed (ex: Roadshow, or Miami).

Miami is not excluded, it works the same way.

I would not call it mapping if you are on a real IP stack. The app calls a library function and this function is part of the IP stack. It does not need to map anything.

The public part of a library, a.k.a. the library base is always created dynamically in memory. And this part is the only thing needed to open a library and call functions of it.

If an app calls OpenLibrary("bsdsocket.library") the OS checks if the library base is already present. If it is it just returns its address to the app.

If the base is not yet present, OpenLibrary tries to load a file called bsdsocket.library and call its init function. This init function then creates the base and adds it to the system's list of library bases.

In case of the IP stack the stack is run as a program. The program creates a library base for bsdsocket.library and adds it to the system's list. This is the same as what the init function would do. The only difference is that it is not done in the context of OpenLibrary.

bwldrbst 30 June 2019 05:29

In the case of AmiTCP, you can find the source of version 3 on Aminet and see exactly how it constructs the bsdsocket.library in memory and adds it to the list of libraries maintained by Exec. For each task that opens the library, AmiTCP will construct a new instance of the library structure.

The file where you can see this happening is in src/amitcp/api/amiga_api.c.

There is no separate library that could be used independently. Amiga libraries are a structure holding some data and a bunch of function pointers. For bsdsocket.library the functions pointed to are part of the AmiTCP executable.

I'm not sure what Roadshow does but I expect most other Amiga TCP stacks work this way.

Olaf Barthel 30 June 2019 19:17

Quote:

Originally Posted by bwldrbst (Post 1329862)
There is no separate library that could be used independently. Amiga libraries are a structure holding some data and a bunch of function pointers. For bsdsocket.library the functions pointed to are part of the AmiTCP executable.

I'm not sure what Roadshow does but I expect most other Amiga TCP stacks work this way.

The "bsdsocket.library" in Roadshow is a disk-loaded shared library, very much like the vast majority of libraries you would find in "LIBS:", such as "diskfont.library" or "iffparse.library". That makes it an "anomaly" among the Amiga TCP/IP stacks, but there is precedent in the AS225R2 TCP/IP stack which Commodore cancelled (it would use disk-loaded shared libraries by the names of "inet.library" and "socket.library"), and the INet-225 product which it is related to (this was used by the "Amiga Surfer" product which Amiga Technologies GmbH released back in 1996).

I understand why AmiTCP, Miami, etc. build the "bsdsocket.library" interface within a program which the user must start. It's much easier to test and debug this design since "all" you have to do is make the TCP/IP stack work and then add the library interfaces to what you built. Now try doing that with a standard disk-loaded library. It's much harder to pull off, and (I admit this here and now) I was stupid enough to try. Often there's a very fine line between being stupid and being clever, and at least in this case I succeeded at crossing over into "being clever" ;) Don't try this at home kids! Pick the design that makes debugging and testing easier for you.

Twiggy 14 November 2023 08:52

Quote:

Originally Posted by bwldrbst (Post 1329862)
In the case of AmiTCP, you can find the source of version 3 on Aminet and see exactly how it constructs the bsdsocket.library in memory and adds it to the list of libraries maintained by Exec. For each task that opens the library, AmiTCP will construct a new instance of the library structure.

The file where you can see this happening is in src/amitcp/api/amiga_api.c.

There is no separate library that could be used independently. Amiga libraries are a structure holding some data and a bunch of function pointers. For bsdsocket.library the functions pointed to are part of the AmiTCP executable.

I'm not sure what Roadshow does but I expect most other Amiga TCP stacks work this way.

Is there any way to use that version of AmiTCP with software that asks for a newer version of bsdsocket? Or would you have to upgrade AmiTCP entirely?

thomas 14 November 2023 19:44

It depends on the reason why the software asks for a newer version.

Normally a request for a higher version means that the software requires new features which only exist on the new version. It would crash if an older version would be hacked to fulfill the request.

Only in rare cases the developer was too lazy to determine the minimum version he needs and just requests the version he used himself.


All times are GMT +2. The time now is 14:46.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.

Page generated in 0.05577 seconds with 11 queries