China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 11:53
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Help with DOS network programming (winsail) View 3,840 Replies 34
Original Poster Posted 2008-01-13 11:32 ·  中国 江苏 南京 电信
初级用户
Credits 100
Posts 41
Joined 2007-12-06 15:52
18-year member
UID 104858
Gender Male
Status Offline
Using bc3.1 + winsail2.0; followed the instructions in the packet driver's documentation to set up the network card driver and related system configuration files, and added the network card driver switch to the config.sys in the created project.

But when calling socket(), it always returns 1, and checking shows the error code is 2;

How to solve this?
Floor 2 Posted 2008-01-13 11:36 ·  中国 江苏 南京 电信
初级用户
Credits 100
Posts 41
Joined 2007-12-06 15:52
18-year member
UID 104858
Gender Male
Status Offline
I myself feel that it is very likely that the network card driver and so on have not started up
Floor 3 Posted 2008-01-14 14:22 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
21-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
To use the TCP/IP stack of WinSail, the following three conditions must be met simultaneously

(1) Install the Packet network card driver. If successful, the physical address (i.e., NIC address) of the network card xx:xx:xx:xx:xx will appear
(2) The NetCard key value in the NetCard section of the configuration file Config.Sys of WinSail is configured as TRUE

NetCard = TRUE
(3) Before calling the InitSystem function in the main function, the TCP/IP stack must be registered with WinSail V2.0
::AfxRegisterNetcardEntry(::GlobalInitSocket, ::GlobalCloseSocket, ::EthernetEntry);


---------------------------------------------------------------------------------------------------
You can use the demonstration program Sail3000 of WinSail to check whether the network is running reliably. First, set the "NetCard" key value in the "NetCard" section of the Config.Sys file in the Sail3000 project file to "TRUE", run the Sail2000.exe file, there is an icon "Network Settings" on the desktop. If the NIC address is not "00:00:00:00:00", then your Packet network card driver has been successfully loaded.
The IP address of your program is specified by the "My_IP" key value in the "Netcard" section. In the demonstration program, I configured it as 169.254.82.133.

[ Last edited by firstsail on 2008-1-14 at 02:52 PM ]
Floor 4 Posted 2008-01-15 19:37 ·  中国 江苏 南京 电信
初级用户
Credits 100
Posts 41
Joined 2007-12-06 15:52
18-year member
UID 104858
Gender Male
Status Offline
The network card driver has been up. I did some socket programming, using the UDP communication protocol, creating a socket - binding - sending data; however, when sending data, it always returns an error?
May I ask if firstsail can provide a sample program for Winsock programming?
Floor 5 Posted 2008-01-15 20:51 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
21-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
(1)Download "WinSail V2.0" from "http://www.firstsail.com.cn/software.html"
(2)After decompression, run "Udp_Demo.exe" in the "WinToDos" directory as the upper computer of the UDP protocol. Correctly fill in the IP address and port number of the lower computer that you are going to communicate with. The default IP address of the lower computer in the program is "169.254.82.133" and the port number is "6200". Finally, "click the start UDP protocol button" to start UDP.
(3)After decompression, copy the Sail3000 directory to the pure DOS environment.
(4)Enter the pure DOS environment to run the demo program Sail2000.exe of WinSail V2.0, enter the icon "QQ Chat Room" on the desktop. Don't forget to configure the "Netcard" key value in the "Netcard" segment of the Config.Sys file in Sail3000 as "True".
You can send some text to see if the upper computer Udp_Demo receives the content.
(5)For the application example of the UDP protocol of the lower computer, you can view the Remote_N.Cpp file and qq.cpp file in the Sail3000 directory.
The Remote_N.cpp file implements functions such as "file transfer", "upload of lower computer interface", and "reception of mouse, keyboard, and button".
The qq.cpp file implements the chat program of "QQ Chat Room".
When debugging the "TCP/IP" protocol of WinSail, please do it in the pure DOS environment!

[ Last edited by firstsail on 2008-1-15 at 08:58 PM ]
Floor 6 Posted 2008-01-15 21:15 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
21-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
I'm sorry, please re-download the updated "Sail3000" directory and "UdpDemo.Exe" program from "http://www.firstsail.com.cn/software.html"
Floor 7 Posted 2008-01-15 21:17 ·  中国 江苏 南京 电信
初级用户
Credits 100
Posts 41
Joined 2007-12-06 15:52
18-year member
UID 104858
Gender Male
Status Offline
Thank you very much for your guidance, I'll go and try it now
Floor 8 Posted 2008-01-15 21:31 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
21-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
If there are still faults, it may be:
(1) Your "router" or "hub" has filtered your IP packets. It is recommended to directly use the "machine-to-machine connection" form for debugging. Note that the network cable for "machine-to-machine connection" is different from the network cable connecting to the "hub" or "router".
(2) Or change the IP address of the lower computer to the same "network" address as the upper computer.

[ Last edited by firstsail on 2008-1-15 at 09:33 PM ]
Floor 9 Posted 2008-01-15 23:00 ·  中国 江苏 南京 电信
初级用户
Credits 100
Posts 41
Joined 2007-12-06 15:52
18-year member
UID 104858
Gender Male
Status Offline
Followed your instructions and prompted "The program did not load the winsail tcp/udp protocol stack"
Floor 10 Posted 2008-01-15 23:16 ·  中国 江苏 南京 电信
初级用户
Credits 100
Posts 41
Joined 2007-12-06 15:52
18-year member
UID 104858
Gender Male
Status Offline
This should have been registered before the winsail system was up. Why does the program prompt like this?

My QQ is 70344130. Why not add me as a friend? I can learn a lot from you.
Floor 11 Posted 2008-01-16 13:27 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
21-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
That's because your "Packet driver" didn't load successfully.

Please provide the following information:
(1) Model of the network card
(2) Content of Config.Sys in the root directory of drive C
(3) Content of AutoExec.bat in the root directory of drive C
(4) Whether you are directly using the Packet driver or using an NDIS2 driver to convert to the Packet driver.


1: If directly using the Packet driver, the driver at this time is a file with the ".Com" suffix or the ".Exe" suffix. Note to add the soft interrupt vector parameter 0x60, such as
LH Rtspkt.com 0x60

2: If using an NDIS2 driver to convert to the Packet driver, the driver at this time is a file with the ".Dos" suffix. Download the "PacketDriver driver" from the "website", decompress it, and refer to the "Instructions.txt" file

[ Last edited by firstsail on 2008-1-16 at 01:36 PM ]
Floor 12 Posted 2008-01-16 16:49 ·  中国 江苏 南京 电信
初级用户
Credits 100
Posts 41
Joined 2007-12-06 15:52
18-year member
UID 104858
Gender Male
Status Offline
But I have checked that the NIC is indeed not "00:00:00:00:00", and the network card driver is loaded according to the instructions on the website you provided.

The config.sys is as follows:
device=c:\windows\himem.sys/testmem:off
device=c:\windows\emm386.exe noems novcpi
devicehigh=c:\intel\protman.dos /i:c:\intel\RTL81xx
devicehigh=c:\intel\dis_pkt.dos
devicehigh=c:\intel\RTL81xx\Rtsnd.dos
dos=high,umb
stacks=12,256
files=30
Note: intel is the folder where my network card driver is located.

The autoexec.bat:
path c:\windows;c:\windows\command
lh smartdrv
c:\intel\netbind.com

There is also a phenomenon. I want to use printf or CHPrintf to print some intermediate flag information in the program (after winsail starts), but I find that these are not output at all when the program is running, but looking at the program execution process, these statements are definitely executed.
Floor 13 Posted 2008-01-16 16:52 ·  中国 江苏 南京 电信
初级用户
Credits 100
Posts 41
Joined 2007-12-06 15:52
18-year member
UID 104858
Gender Male
Status Offline
By the way, in autoexec.bat, the system seems to have automatically added rem - By Windows 98 Network - c:\intel\netbind.com
Floor 14 Posted 2008-01-16 18:12 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
21-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
Is there a simplest way to load "Packet Driver" is to use the debug program to check whether the content of the 60H interrupt vector has the string "PKT DRVR"

(1) The first step, execute "Debug" under the DOS command line
(2) The second step, type "d180" and press Enter,
(3) The third step, pay attention to the consecutive four bytes jj kk mm nn indicated by D180. If it is 00 00 00 00, it is not loaded successfully, otherwise the fourth step

(4) The fourth step, type d nnmm:kkjj and press Enter (note: nn mm kk jj is the result of the third step)
(5) The fifth step, check whether there is the string "PKT DRVR" on the right side of the screen. If there is, it is loaded successfully, otherwise it is not loaded successfully

[ Last edited by firstsail on 2008-1-16 at 07:16 PM ]
Floor 15 Posted 2008-01-16 18:16 ·  中国 广东 深圳 电信
高级用户
★★
Credits 668
Posts 295
Joined 2005-07-26 00:00
21-year member
UID 41110
Gender Male
From 广东深圳
Status Offline
Originally posted by tianmian at 2008-1-16 16:52:
By the way, in autoexec.bat, the system seems to have automatically added c:\intel\netbind.com
rem - By Windows 98 Network - c:\intel\netbind.com



(1) Change back to "c:\intel\netbind.com"

(2) When Win98 starts, quickly press the "F8" function key, and a "Win98" menu will pop up, with a total of 6 menu items. Select item "5" to enter "Pure DOS", which is DOS7.0, or set the "BootMenu" in the MsDos.Sys file in the root directory of drive C to "1" and then restart Win98. Wait until the menu pops up automatically and then execute item "5" to enter DOS7.0. Before modifying the msdos.sys file, you need to remove the "Read-only" attribute of the file



BootMulti=0
BootMenu=1
BootWin=0
BootGui=0



(3) Please paste the Protocol.ini file for me to take a look

[ Last edited by firstsail on 2008-1-16 at 07:03 PM ]
Forum Jump: