Networking discussion

Discussion of development and patch submission.
ndavis82
Posts: 47
Joined: Sun 25 Dec, 2016 5:54 am

Re: Networking discussion

Post by ndavis82 »

Very cool!! I tested NE2000 under Windows 98 and it works great! TCP/IP working fantastic!
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Networking discussion

Post by SarahWalker »

jznomoney wrote:can you repost how to configure for pcap if you have time. thanks in advanced.
Rev 823 adds a GUI dialogue to configure this.
ndavis82
Posts: 47
Joined: Sun 25 Dec, 2016 5:54 am

Re: Networking discussion

Post by ndavis82 »

The Voodoo configuration box is in the wrong place now since the latest commit.
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Networking discussion

Post by SarahWalker »

Fixed in rev 824.
basic2004
Posts: 124
Joined: Sun 08 Jan, 2017 5:59 pm

Re: Networking discussion

Post by basic2004 »

I compiled latest source but I met these errors with default settings of makefile.
These included -Wall -Werror arguments.

Code: Select all

In file included from ne2000.c:35:0:
slirp/slirp.h:334:21: error: inline function 'remque_32' declared but never defined [-Werror]
  extern inline void remque_32 _P((void *));
                     ^~~~~~~~~
slirp/slirp.h:333:21: error: inline function 'insque_32' declared but never defined [-Werror]
  extern inline void insque_32 _P((void *, void *));
                     ^~~~~~~~~

Code: Select all

In file included from nethandler.c:2:0:
G:/backup-drivec/msys-pcem-fs116/mingw32/i686-w64-mingw32/include/winsock2.h:15:2: error: #warning Please include winsock2.h before windows.h [-Werror=cpp]
 #warning Please include winsock2.h before windows.h
  ^~~~~~~
and I saw these warnings from slirp.

Code: Select all

gcc -I. -Ofast -Wall -c misc.c -o misc.o
misc.c: In function 'getouraddr':
misc.c:95:18: warning: passing argument 1 of 'gethostname' from incompatible pointer type [-Wincompatible-pointer-types]
  if (gethostname(&buff,500) == 0)
                  ^
In file included from slirp.h:42:0,
                 from misc.c:10:
G:/backup-drivec/msys-pcem-fs116/mingw32/i686-w64-mingw32/include/winsock2.h:1004:34: note: expected 'char *' but argument is of type 'char (*)[512]'
   WINSOCK_API_LINKAGE int WSAAPI gethostname(char *name,int namelen);
                                  ^~~~~~~~~~~
misc.c:96:32: warning: passing argument 1 of 'gethostbyname' from incompatible pointer type [-Wincompatible-pointer-types]
             he = gethostbyname(&buff);
                                ^
In file included from slirp.h:42:0,
                 from misc.c:10:
G:/backup-drivec/msys-pcem-fs116/mingw32/i686-w64-mingw32/include/winsock2.h:1003:46: note: expected 'const char *' but argument is of type 'char (*)[512]'
   WINSOCK_API_LINKAGE struct hostent *WSAAPI gethostbyname(const char *name);
                                              ^~~~~~~~~~~~~
gcc -I. -Ofast -Wall -c queue.c -o queue.o
gcc -I. -Ofast -Wall -c sbuf.c -o sbuf.o
gcc -I. -Ofast -Wall -c slirp.c -o slirp.o
slirp.c: In function 'slirp_select_poll':
slirp.c:439:26: warning: passing argument 2 of 'send' from incompatible pointer type [-Wincompatible-pointer-types]
        ret = send(so->s, &ret, 0, 0);  //This is what it should be.
                          ^
In file included from slirp.h:42:0,
                 from slirp.c:1:
G:/backup-drivec/msys-pcem-fs116/mingw32/i686-w64-mingw32/include/winsock2.h:997:34: note: expected 'const char *' but argument is of type 'int *'
   WINSOCK_API_LINKAGE int WSAAPI send(SOCKET s,const char *buf,int len,int flags);
                                  ^~~~
slirp.c:485:26: warning: passing argument 2 of 'send' from incompatible pointer type [-Wincompatible-pointer-types]
        ret = send(so->s, &ret, 0,0);
                          ^
In file included from slirp.h:42:0,
                 from slirp.c:1:
G:/backup-drivec/msys-pcem-fs116/mingw32/i686-w64-mingw32/include/winsock2.h:997:34: note: expected 'const char *' but argument is of type 'int *'
   WINSOCK_API_LINKAGE int WSAAPI send(SOCKET s,const char *buf,int len,int flags);
                                  ^~~~
But I solved these warnings.

Here is a patch. no more warnings after this patch.
pcem-network-fix-warning.patch
(2.14 KiB) Downloaded 428 times
I got this idea from 86Box's slirp files,
when I compile it, there was no warnings.
Thanks to them.
jznomoney
Posts: 97
Joined: Sat 06 Dec, 2014 9:11 pm

Re: Networking discussion

Post by jznomoney »

How do you enable pcap with the merged network patch? I have the guid from ethlist but I cannot figure out how to enable pcap as default. It keeps defaulting to slirp.
basic2004
Posts: 124
Joined: Sun 08 Jan, 2017 5:59 pm

Re: Networking discussion

Post by basic2004 »

jznomoney wrote:How do you enable pcap with the merged network patch? I have the guid from ethlist but I cannot figure out how to enable pcap as default. It keeps defaulting to slirp.
You must install WinPcap in your Windows.
And you must extract WinPcap Developer's Pack in your MinGW before compile.

See this latest posts, how to build and download Pcap.
https://pcem-emulator.co.uk/phpBB3/view ... ?f=3&t=597
jznomoney
Posts: 97
Joined: Sat 06 Dec, 2014 9:11 pm

Re: Networking discussion

Post by jznomoney »

I did that. I followed your guide.
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Networking discussion

Post by SarahWalker »

You shouldn't need ethlist anymore, the GUI in rev 823 should allow you to select the device.
jznomoney
Posts: 97
Joined: Sat 06 Dec, 2014 9:11 pm

Re: Networking discussion

Post by jznomoney »

oops I missed the added parts to the gui. Sorry for the confusion.
User avatar
omarsis81
Posts: 945
Joined: Thu 17 Dec, 2015 6:20 pm

Re: Networking discussion

Post by omarsis81 »

Sarah: will we have two EXEs of PCem for the upcoming release? Or just a single one with the network card?
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Networking discussion

Post by SarahWalker »

Haven't decided yet. I'd prefer one binary if possible.
User avatar
omarsis81
Posts: 945
Joined: Thu 17 Dec, 2015 6:20 pm

Re: Networking discussion

Post by omarsis81 »

I'd go with the one binary too! Doesn't make sense to have a non network version!
User avatar
SarahWalker
Site Admin
Posts: 2054
Joined: Thu 24 Apr, 2014 4:18 pm

Re: Networking discussion

Post by SarahWalker »

Should now work under Linux as of rev 836. Pass --enable-networking to ./configure.
ecksemmess
Posts: 183
Joined: Wed 18 Mar, 2015 5:27 am

Re: Networking discussion

Post by ecksemmess »

This is great to see! Thanks to Sarah, neozeed, and everyone else who's worked on this.

Quick question: can someone very briefly summarize the relative advantages and disadvantages of slirp vs. pcap in the specific context of how they've been implemented here?
JosepMa
Posts: 202
Joined: Tue 20 Jun, 2017 6:25 pm

Re: Networking discussion

Post by JosepMa »

While I don't know how the networking code has been implemented, the difference between the slirp and pcap concepts lies on where the communication happens.

The concept of slirp does not require a system driver, because the application is acting on behalf of the emulated system. In some sense, it works more like a transparent proxy.
-pros: no additional software needed, no additional configuration needed, good for client scenario (i.e. web browsing, connecting to other services on internet...)
-cons: it can be used on server scenario, but only by explictly making the application open the ports and listen to connections. Communication guest->host is not possible, or requires workarounds, neither between multiple guests. The IP network is separated from the host one.

The concept of pcap uses a system driver because it has to emulate an ethernet adapter. It simulates an internal ethernet network. It also offers an additional "bridged" mode, where it does not use a virtual ethernet card, but instead attaches itself to the existing card at the driver level, so it intercepts and adds network paquets directly from/into it. This way, it can act as a router at the card level.
-pros: you can have an internal network of multiple guests and host that are all on the same IP network (usually useful for non-internet access), or you can use the bridged mode, and let the guests access the internet without problems. (client and server).
-cons: it requires the installation of the driver, so you might need administration access to the machine. It needs more configuration (determine the mode that you want to use, configure IPs, select cards..). Throughput can be worse (back to Windows Vista days, the emulated card was 10Mbit! ).

Many years ago I played with colinux and pcap, and was using both pcap modes, the bridged mode for internet access (apt-get ), and the virtual adapter for host<->guest communication ( X-window , pulseaudio , filesharing ). I still have a two cards mode on a VirtualBox machine, although I no longer use the x-window scenario.
User avatar
leilei
Posts: 1039
Joined: Fri 25 Apr, 2014 4:47 pm

Re: Networking discussion

Post by leilei »

Haven't tried PCem on Pcap yet but i know i've tried it on a DOSBox build with it about a decade ago. It allowed the card to handle IPX (this protocol not installed on the host OS) and connected to one of my old machines running a network game on ipx natively.
User avatar
ender
Posts: 51
Joined: Tue 14 Oct, 2014 12:51 pm

Re: Networking discussion

Post by ender »

SLiRP just lets you use TCP/IP from emulated system (and even that has some limitations), so it's not really that useful with PCem (unless you want to test old web browsers). The emulated system behaves as if it was behind a NAT router, so incoming connections aren't possible, and you can't use any other networking protocol, because SLiRP simply wasn't set up to handle that (in VMWare and VirtualBox the NAT mode is analogous to SLiRP).

With pcap, PCem emulates a computer connected directly to your LAN, as if it was connected directly to the switch. This means that all protocols work (which lets you run old multiplayer games that rely on IPX/SPX), however it probably won't work if you only have a WLAN connection (this is what VMWare and VirtualBox call bridged mode).
ecksemmess
Posts: 183
Joined: Wed 18 Mar, 2015 5:27 am

Re: Networking discussion

Post by ecksemmess »

Thanks, ender! That's exactly the kind of explanation I was looking for.
Post Reply