English Amiga Board


Go Back   English Amiga Board > Support > support.WinUAE

 
 
Thread Tools
Old 21 June 2019, 01:01   #1
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
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?

Last edited by Sim085; 21 June 2019 at 01:06.
Sim085 is offline  
Old 21 June 2019, 01:42   #2
alpine9000
Registered User
 
Join Date: Mar 2016
Location: Australia
Posts: 881
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.
alpine9000 is offline  
Old 21 June 2019, 02:04   #3
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
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.
AMIGASYSTEM is offline  
Old 21 June 2019, 08:57   #4
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
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 View Post
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 View Post
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 is offline  
Old 21 June 2019, 09:03   #5
Predseda
Puttymoon inhabitant
 
Predseda's Avatar
 
Join Date: Mar 2007
Location: Tromaville
Age: 46
Posts: 7,537
Send a message via ICQ to Predseda
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?
Predseda is offline  
Old 21 June 2019, 09:42   #6
patrik
Registered User
 
patrik's Avatar
 
Join Date: Jan 2005
Location: Umeå
Age: 43
Posts: 922
@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.
patrik is offline  
Old 21 June 2019, 10:22   #7
AMIGASYSTEM
Registered User
 
AMIGASYSTEM's Avatar
 
Join Date: Aug 2014
Location: Brindisi (Italy)
Age: 70
Posts: 8,248
Quote:
Originally Posted by Sim085 View Post
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
AMIGASYSTEM is offline  
Old 21 June 2019, 10:34   #8
Predseda
Puttymoon inhabitant
 
Predseda's Avatar
 
Join Date: Mar 2007
Location: Tromaville
Age: 46
Posts: 7,537
Send a message via ICQ to Predseda
Quote:
Originally Posted by patrik View Post
@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?
Predseda is offline  
Old 21 June 2019, 13:12   #9
patrik
Registered User
 
patrik's Avatar
 
Join Date: Jan 2005
Location: Umeå
Age: 43
Posts: 922
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.
patrik is offline  
Old 28 June 2019, 16:18   #10
Phantasm
Not a Rebel anymore
 
Phantasm's Avatar
 
Join Date: Apr 2005
Location: UK
Age: 51
Posts: 497
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.
Phantasm is offline  
Old 28 June 2019, 21:50   #11
patrik
Registered User
 
patrik's Avatar
 
Join Date: Jan 2005
Location: Umeå
Age: 43
Posts: 922
@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.
patrik is offline  
Old 29 June 2019, 00:30   #12
McTrinsic
Registered User
 
Join Date: Feb 2014
Location: Germany
Posts: 527
Any chance to dump a lib from ram to use it maybe later as a file?
McTrinsic is offline  
Old 29 June 2019, 02:46   #13
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,771
Quote:
Originally Posted by McTrinsic View Post
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.
Hewitson is offline  
Old 29 June 2019, 08:53   #14
Sim085
Registered User
 
Join Date: Apr 2009
Location: N/A
Posts: 962
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 View Post
You could, but what are you going to do with the library? It is absolutely useless without a TCP/IP stack.
Sim085 is offline  
Old 29 June 2019, 09:44   #15
Hewitson
Registered User
 
Hewitson's Avatar
 
Join Date: Feb 2007
Location: Melbourne, Australia
Age: 41
Posts: 3,771
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.
Hewitson is offline  
Old 29 June 2019, 10:45   #16
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
Quote:
Originally Posted by Sim085 View Post
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.
thomas is offline  
Old 30 June 2019, 05:29   #17
bwldrbst
Registered User
 
bwldrbst's Avatar
 
Join Date: Nov 2015
Location: Perth, Australia
Posts: 73
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.
bwldrbst is offline  
Old 30 June 2019, 19:17   #18
Olaf Barthel
Registered User
 
Join Date: Aug 2010
Location: Germany
Posts: 532
Quote:
Originally Posted by bwldrbst View Post
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.
Olaf Barthel is offline  
Old 14 November 2023, 08:52   #19
Twiggy
\m/
 
Twiggy's Avatar
 
Join Date: Nov 2008
Location: Devon, U.K.
Posts: 573
Quote:
Originally Posted by bwldrbst View Post
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?
Twiggy is offline  
Old 14 November 2023, 19:44   #20
thomas
Registered User
 
thomas's Avatar
 
Join Date: Jan 2002
Location: Germany
Posts: 6,985
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.
thomas is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
UAE bsdsocket.library inconsistensy patrik support.WinUAE 4 01 April 2017 13:43
Bsdsocket.Library Emufr3ak Coders. Asm / Hardware 5 25 December 2016 11:20
Crosscompiling with bsdsocket.library ciVic Coders. General 6 05 January 2016 11:56
winuae bsdsocket.library clauddio support.WinUAE 5 21 July 2015 21:47
BSDSocket.library error with version 1.5+ Icreadence support.WinUAE 7 28 August 2008 04:16

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:24.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.22231 seconds with 13 queries