『第 12 楼』:
使用 LLM 解释/回答一下
通过串口并口共享资源
在两台计算机之间进行通信,最好的方法当然是建立局域网。如果没有建立
网络,又想进行联机通信,在距离不太远(比如不超过20米)的情况下,可考虑通
过计算机的并行口或RS-232串行口直接对接两台机器,以此来实现通信、数据和
文件传输及软、硬件资源共享。采用端口连接双机进行数据传输,不需要网卡,
不需要调制解调器,也不用软磁盘作媒介,是通信和数据传输的一种简单易行的
好方法。尤其值得称道的是可以实现双机间软、硬件资源的共享,如共享硬盘、
光驱和打印机等。
进行两台微机点对点通信,在硬件上要用连接线将并口或串口连接起来,然后在
通信软件的支持下才能实现。本文从信号线的连接方法、连接线的制作和通信软
件三个方面全面介绍了两台微机不用网卡进行点对点通信的实现技术。
一、信号线的连接方法
微机通常有一个并口和两个标准的RS-232串口,我们可以选其中的任何一个
端口来进行两台机器间的通信。在可能的情况下,应尽量用并口通信,因为并口
的传输率远高于串口。
串口1(COM1)多为9芯,而串口2(COM2)和并口则是25芯引脚。各端口引脚功能不同
,对接法也不同。
1.串口通信
串口间通信只要连接三条线就可以了,即收、发数据线和信息地线。在连接
时,对一台机来说是发送数据,对另一台机就是接收数据,所以收、发数据线要
换接。串口间通信具体有如下三种连接方法。
(1)9芯对9芯串口
A机 B机
2●←→●3
3●←→●2
5●←→●5
(2)9芯(A机)对25芯(B机)串口
A机 B机
2●←→●3
3●←→●2
5●←→●7
(3)25芯串口对25芯串口
A机 B机
2●←→●3
3●←→●2
7●←→●7
2、并口通信
并口引脚只有10、11、12、13、15等5条输入线,所以在进行双机连接通信时
,也只能使用5条输出线,因此,两机并口间通信的连接法如下。
上述列出的数字是接头的引脚号,这些引脚号在串、并行端口上通常都有注
明。由于并口用5对线来进行数据传送,数据传输速度比用串口通信快得多,所以
应尽量使用并口连接,尤其是在需要在两机间进行大量数据传送时。
二、连接线的制作
连接两台机器之间的连接线可以到电脑配件商店去购买。在购买时要弄清楚
两边的接头是针还是孔,通常连接两个并口用的是25针对25针的,而连接两个串
口的是孔对孔的。
连接线也可以自己制作。不管计算机上的插座是针还是孔,直接用导线进行
连接是比较困难的,造成接口处接触不良。这里推荐两种利用废旧鼠标的连接线
制作串口连接线和利用废旧打印机电缆线制作并口连接线的方法。
1.制作9芯串口连接线
鼠标器只用了串口9个引脚中的4个,就是引脚2、3、5、7。利用串口通信时
,只需要连接引脚2、3、5就可以了。鼠标器是一个容易损坏的器件,且损坏处主
要是鼠标头,其连线和接头一般不会坏。把两个报废的鼠标器的连线剪下来,可
以发现在保护外皮下有4条导线,其颜色为棕、黄、绿、白,分别对应引脚2、3、
5、7。根据前面介绍的连接方法,将两条鼠标器连线中的绿线对接,棕、黄线换
接(即第一侧的棕线接第二侧的黄线,而第一侧的黄线接第二侧的棕线),白线不
用。线接好后用胶布把接口处扎好,一条9孔对9孔的串口连接线就做好了。用报
废的鼠标连线制作串口连接线,方便实用、省时经济,是一种废物利用的好方法
。
2.制作并口连接线
用打印机电缆制作并口连接线也很方便。先将电缆的两头都拆开,把连接打
印机的一端线头都焊下来;然后以该电缆线的另一端的引脚号和线的颜色为依据
,将焊下来的相应颜色的导线按照前面介绍的并口连接法焊到一个25芯的D型插头
的相应引脚上;最后把连接机壳的地线焊接到D型插头上。这样,一条25芯并口对
并口的连接电缆就做好了。
3.制作25芯对25芯串口连接线
制作25芯对25芯串口连接线要用两个25孔的插头,还需一个废旧鼠标的连接
线,根据导线的颜色和前面介绍的连接法,将导线两端焊在相应的引脚上就可以
了。
三、通信软件
将连接线的两端插到两台机器对应的串口上,还不能立即进行数据通信,还
必须有通信软件的支持。能够实现两机互联直接通信的软件很多,常用的有以下
几种,可根据实际情况择一而用之。
1.Windows 95的直接电缆连接
Windows 95的“直接电缆连接”功能允许用电缆直接连接两台机的并口或串
口,实现联机通信。其建立连接和实现通信的过程如下。
(1)在服务器安装直接电缆连接
①Windows 95桌面环境下,通过“我的电脑”→“控制面板”→“网络”,
选择“拨号网络适配器”,在“基本网络登录方式(L)”窗口选择“Microsoft网
络客户”。
②通过“我的电脑”→“控制面板”→“添加/删除程序”→“安装Windows
”→“通信”→“直接电缆连接”,安装“直接电缆连接”程序。
③通过“我的电脑”→“控制面板”→“网络”→“文件和打印共享”确定
共享权限,这里有“能够提供他人访问我的文件的权限”和“能够让他人打印到
我的打印机上”两个选择项。
④通过“我的电脑”,右击该窗口中任何一个驱动器符,选择“共享”,即
进入共享级别设置窗口,在该窗口可设置共享级别及口令等。如要共享别的驱动
器,可在“我的电脑”窗口再右击别的驱动器符,设置共享级别及口令即可。用
同样方法也可设置共享文件夹。
⑤通过“开始”→“程序”→“附件”→“直接电缆连接”运行直接电缆连
接程序,设置为“主机”,并选择COM1作连接的端口。
这样,一个提供共享资源的服务器就设置好了。以后要进行连接,若不作修改的
话,只要运行“直接电缆连接”程序就行了。如果要改变连接端口、将服务器改
变为客户机或修改共享资源,则要修改相应的设置。
(2)在客户机安装直接电缆连接
在客户机安装直接电缆连接程序的方法与在服务器上安装一样。直接电缆连
接程序安装好后便运行,设置为“客户机”,并选择COM1为连接的端口。
以后只要直接运行直接电缆连接程序就可以了,不要再设置,除非想修改设置。
(3)优缺点
在服务器和客户机分别运行直接电缆连接程序就能建立服务器和客户机之间
的连接。如果有口令,在连接时还会进行口令验证。连接建立以后,在客户端可
通过Windows 95桌面的“网上邻居”访问服务器的共享资源。
用Windows 95的直接电缆连接程序连接两台微机并实现通信的主要优越性在
于:①连接建立后,客户机可使用服务器提供的共享资源,客户机和服务器也可各
自独立运行;②如果所连接的服务器已经上了局域网,客户机还可通过服务器访问
所有的网上资源;③可共享服务器上的所有资源,如光驱、网络驱动器等。
使用Windows 95的直接电缆连接程序连接两台微机进行通信的唯一不足是对
机器要求较高,因为客户机和服务器都要安装Windows 95/98才能进行连接,而一
些低档机如386以下的机器是不能安装和运行Windows 95/98的。
2.PCTools 9.0的DRIVEMAP
PCTools 9.0提供了一个比较实用、方便的双机联机通信软件DRIVEMAP,它可
通过串口或并口连接两台电脑,用一个本机的空盘符映像另一台机的一个物理盘
。我们把用一个盘符映像另一台机的某一驱动器的机器叫服务器,而另一台驱动
器被映像的机器叫客户机。通过DRIVEMAP进行联机通信的方法如下。
(1)先在客户机运行DRIVEMAP。
在客户机系统提示符下键入DRIVEMAP(设当前目录或备查目录中有该文件)。
若是首次运行DRIVEMAP,则出现DRIVEMAP的安装窗口,并要求输入用户名和口令
名。用户名是必须输入的,以标识联接的不同微机。口令项是可选择的,不想要
口令直接按回车键即可。然后选Next项进入下一级连接设备选择菜单,选择COM1
串口。然后选择OK进入设备重定向选择菜单。如果不是第一次运行DRIVEMAP,就
直接进入设备重定向选择菜单。按x或Esc键退出DRIVEMAP安装,客户机的连接准
备工作就做好了。
(2)在服务器运行DRIVEMAP,屏幕显示及操作同客户机安装DRIVEMAP。在列出
的本机所有使用的驱动器与未用的但可使用的驱动器符中选择一个驱动器字符作
映像用。系统如果没有空盘符可用,须对CONFIG.SYS文件中的“LASTDRIVER=”语
句进行修改,使系统中有可用的空盘符。将DRIVEMAP的操作光条移到空盘符标记
上(假设是F:),回车。选择联机用的端口COM1并回车,然后确定本机的F盘符与另
一台机的哪个驱动器相连,选择后按O键退回上一窗口,再按Esc(或x)键退出DRI
VEMAP的界面。此后,两台机就可以通信了。而且两台机可独立操作,不受影响。
(3)优缺点
用PCTools 9.0中的DRIVEMAP作为双机间的通信软件,有许多突出的优点:①
服务器把客户机的一个驱动器(包括光驱)当作自己的驱动器一样来使用,如果服
务器的环境(内存大小、BIOS版本、显卡和显示器等)许可,在被映像的驱动器上
的所有可执行文件均可运行;②双机建立连接后,均可独立运行;③可映像CD-R
OM。
DRIVEMAP的不足是它只能映像客户机的一个驱动器,若要映像客户机的另一
个驱动器,必须先退出已映像驱动器,再重新选择要映像的驱动器。另外,若要
改变所连接的端口,在做了改变后,必须重新启动系统方能生效。
3.Norton Commander的Link
Norton Commander的Link也提供了联机通信的功能,具体操作如下。
(1)在从机运行NC
在系统提示符下运行NC,按F9键进入NC的主菜单,选择Left或Right中的Lin
k项,选择COM1,然后选择Slave,将光标移到Link处并回车。
(2)在主机运行NC
在主机运行NC后也按F9键进入NC主菜单,选择Left或Right中的Link项,选择
COM1,然后选择Master,将光标移到Link处并回车。这样,两台机就连接好了,
可以在主机上通过左(或右)面板访问从机各驱动器上的数据。
(3)优缺点
利用NC作为两机间的通信软件,其优点是可对从机各驱动器上的数据进行访
问,包括CD-ROM。但也有许多不足:①在通信期间,从机不能作任何操作;②在主
机上,只能用NC面板上提供的操作命令对从机被连接的驱动器中的数据进行操作
,功能很有限;③不能运行被连接盘上的可执行文件,也不能对被连接盘上的文
本文件进行编辑。
4.DOS的INTERLNK软件
6.0以上版本的DOS提供了通过计算机的并行口或串行口进行互联,从而实现
计算机间资源共享的程序,这就是INTERLNK和INTERSVR。前者在客户机(Client)
上运行,后者在服务器(Server)上运行。不管是在客户机还是在服务器上,必须
在CONFIG.SYS文件里加入命令行:DEVICE=C:\DOS\INTERLNK.EXE。客户机和服务器
建立连接的步骤如下。
(1)在用作服务器的机器系统提示符下键入INTERSVR命令。
(2)在服务器运行INTERSVR的条件下,在用作客户机的机器的系统提示符下键
入INTERLNK命令,屏幕显示本机的(客户机)的空盘符与另一台机(服务器)的实际
驱动器的映像关系。此后,用客户机的空盘符可操作服务器的实际驱动器。
(3)优缺点
使用DOS的INTERLNK软件进行双机间的连接和通信,其突出的优点是可在客户
机上用多个盘符映像服务器上的多个驱动器,且不用设置连接端口,INTERLNK会
自动识别所连接的端口。其不足之处在于:①在联机期间,服务器不能做任何别的
工作;②不能映像网络驱动器和CD-ROM。
Sharing Resources via Serial and Parallel Ports
The best way to communicate between two computers is, of course, to set up a local area network. If there is no network established and you want to carry out online communication, and the distance is not too far (for example, not more than 20 meters), you can consider directly connecting the two machines through the parallel port or RS-232 serial port of the computer to realize communication, data and file transfer, and sharing of software and hardware resources. Using port connection for data transfer between two computers does not require a network card, a modem, or a floppy disk as a medium. It is a simple and easy method for communication and data transfer. What is especially commendable is that it can realize the sharing of software and hardware resources between the two computers, such as sharing hard disks, CD-ROM drives, and printers.
To carry out point-to-point communication between two microcomputers, hardware is needed to connect the parallel port or serial port with a connection cable, and then it can be realized with the support of communication software. This article comprehensively introduces the implementation technology of point-to-point communication without a network card between two microcomputers from three aspects: connection method of signal lines, production of connection cables, and communication software.
I. Connection Method of Signal Lines
Microcomputers usually have one parallel port and two standard RS-232 serial ports. We can choose any one of these ports for communication between the two machines. If possible, parallel port communication should be used as much as possible because the transmission rate of the parallel port is much higher than that of the serial port.
Serial port 1 (COM1) is mostly 9-pin, while serial port 2 (COM2) and the parallel port are 25-pin. The functions of the pins of each port are different, and the connection methods are also different.
1. Serial Port Communication
Only three wires need to be connected for communication between serial ports, namely the receiving and transmitting data lines and the information ground wire. When connecting, for one machine, it is transmitting data, and for the other machine, it is receiving data, so the receiving and transmitting data lines need to be cross-connected. There are the following three specific connection methods for communication between serial ports.
(1) 9-pin to 9-pin serial port
A machine B machine
2●←→●3
3●←→●2
5●←→●5
(2) 9-pin (A machine) to 25-pin (B machine) serial port
A machine B machine
2●←→●3
3●←→●2
5●←→●7
(3) 25-pin serial port to 25-pin serial port
A machine B machine
2●←→●3
3●←→●2
7●←→●7
2. Parallel Port Communication
There are only 5 input lines such as pins 10, 11, 12, 13, 15 on the parallel port. Therefore, when carrying out double-machine connection communication, only 5 output lines can be used. Therefore, the connection method between the parallel ports of the two machines is as follows.
The numbers listed above are the pin numbers of the connectors, and these pin numbers are usually marked on the serial and parallel ports. Since the parallel port uses 5 pairs of lines for data transmission, the data transmission speed is much faster than that of serial port communication. Therefore, the parallel port should be used as much as possible, especially when a large amount of data needs to be transmitted between the two machines.
II. Production of Connection Cables
The connection cables between the two machines can be purchased at computer accessory stores. When purchasing, it is necessary to clarify whether the connectors on both sides are pins or holes. Usually, a 25-pin to 25-pin connector is used for connecting two parallel ports, and a hole-to-hole connector is used for connecting two serial ports.
Connection cables can also be made by oneself. No matter whether the sockets on the computer are pins or holes, it is relatively difficult to directly connect with wires, resulting in poor contact at the interface. Here, two methods are recommended: making a serial port connection cable using the connection cable of a waste mouse, and making a parallel port connection cable using the waste printer cable.
1. Production of 9-pin Serial Port Connection Cable
The mouse only uses 4 of the 9 pins of the serial port, namely pins 2, 3, 5, and 7. When using serial port communication, only pins 2, 3, and 5 need to be connected. The mouse is a device that is easy to damage, and the main damage part is the mouse head. Its connection cable and connector generally do not break. Cut off the connection cables of two scrapped mice, and it can be found that there are 4 wires under the protective sheath, with colors brown, yellow, green, and white, corresponding to pins 2, 3, 5, and 7 respectively. According to the connection method introduced earlier, cross-connect the green wires in the two mouse connection cables, and cross-connect the brown and yellow wires (that is, the brown wire on the first side is connected to the yellow wire on the second side, and the yellow wire on the first side is connected to the brown wire on the second side), and the white wire is not used. After the wires are connected, tape the interface to make a 9-hole to 9-hole serial port connection cable. Using the waste mouse connection cable to make the serial port connection cable is convenient, practical, time-saving, and economical, and it is a good method of waste utilization.
2. Production of Parallel Port Connection Cable
It is also convenient to make a parallel port connection cable using a printer cable. First, disassemble both ends of the cable, and solder down all the wires at the end connected to the printer; then, according to the pin numbers and wire colors at the other end of the cable, solder the corresponding colored wires to the corresponding pins of a 25-pin D-type plug according to the parallel port connection method introduced earlier; finally, solder the ground wire connecting the chassis to the D-type plug. In this way, a 25-pin parallel port to parallel port connection cable is made.
3. Production of 25-pin to 25-pin Serial Port Connection Cable
To produce a 25-pin to 25-pin serial port connection cable, two 25-hole plugs are needed, and a waste mouse connection cable is also needed. According to the wire colors and the connection method introduced earlier, solder the wires at both ends to the corresponding pins.
III. Communication Software
After inserting both ends of the connection cable into the corresponding serial ports of the two machines, data communication cannot be carried out immediately, and support from communication software is also required. There are many software that can realize direct communication between two machines, and the following are commonly used ones, which can be selected according to the actual situation.
1. Direct Cable Connection of Windows 95
The "Direct Cable Connection" function of Windows 95 allows using a cable to connect the parallel port or serial port of two machines to realize online communication. The process of establishing the connection and realizing communication is as follows.
(1) Install Direct Cable Connection on the server
① In the Windows 95 desktop environment, through "My Computer" → "Control Panel" → "Network", select "Dial-up Network Adapter", and in the "Basic Network Logon Type (L)" window, select "Microsoft Network Client".
② Through "My Computer" → "Control Panel" → "Add/Remove Programs" → "Install Windows" → "Communication" → "Direct Cable Connection", install the "Direct Cable Connection" program.
③ Through "My Computer" → "Control Panel" → "Network" → "File and Print Sharing", determine the sharing permissions. There are two options: "Can provide others with access to my files" and "Can let others print to my printer".
④ Through "My Computer", right-click any drive letter in this window, select "Sharing", that is, enter the sharing level setting window. In this window, the sharing level and password can be set. If other drives are to be shared, right-click other drive letters in the "My Computer" window and set the sharing level and password. The same method can be used to set shared folders.
⑤ Through "Start" → "Programs" → "Accessories" → "Direct Cable Connection", run the Direct Cable Connection program, set it as "Host", and select COM1 as the connection port.
In this way, a server providing shared resources is set up. In the future, when connecting, if no modification is made, just run the "Direct Cable Connection" program. If the connection port needs to be changed, the server is changed to a client, or the shared resources are modified, the corresponding settings need to be modified.
(2) Install Direct Cable Connection on the client
The method of installing the Direct Cable Connection program on the client is the same as that on the server. After the Direct Cable Connection program is installed on the client, run it, set it as "Client", and select COM1 as the connection port. In the future, just run the Direct Cable Connection program directly, and no more settings are needed unless the settings need to be modified.
(3) Advantages and disadvantages
By running the Direct Cable Connection program on the server and the client respectively, the connection between the server and the client can be established. If there is a password, the password verification will be carried out during the connection. After the connection is established, the client can access the shared resources of the server through "Network Neighborhood" on the Windows 95 desktop.
The main advantages of using the Direct Cable Connection program of Windows 95 to connect two microcomputers and realize communication are: ① After the connection is established, the client can use the shared resources provided by the server, and the client and the server can run independently; ② If the connected server has been on the local area network, the client can also access all online resources through the server; ③ All resources on the server can be shared, such as CD-ROM drives, network drives, etc.
The only shortcoming of using the Direct Cable Connection program of Windows 95 to connect two microcomputers for communication is that the requirements for the machines are relatively high, because both the client and the server need to install Windows 95/98 for connection, and some low-end machines such as those below 386 cannot install and run Windows 95/98.
2. DRIVEMAP of PCTools 9.0
PCTools 9.0 provides a relatively practical and convenient double-machine online communication software DRIVEMAP, which can connect two computers through a serial port or a parallel port, and use an empty drive letter of the local machine to map a physical drive of another machine. We call the machine that uses a drive letter to map a certain drive of another machine the server, and the machine whose drive is mapped the client. The method of carrying out online communication through DRIVEMAP is as follows.
(1) First, run DRIVEMAP on the client.
At the system prompt of the client, type DRIVEMAP (assuming that the file is in the current directory or the备查 directory). If it is the first time to run DRIVEMAP, the installation window of DRIVEMAP will appear, and it will require entering the user name and password. The user name must be entered to identify different microcomputers connected. The password item is optional, and just press the Enter key if no password is wanted. Then select Next to enter the next-level connection device selection menu, select the COM1 serial port. Then select OK to enter the device redirection selection menu. If it is not the first time to run DRIVEMAP, directly enter the device redirection selection menu. Press x or Esc key to exit the DRIVEMAP installation, and the connection preparation work of the client is done.
(2) Run DRIVEMAP on the server, and the screen display and operation are the same as the client installing DRIVEMAP. In the listed all used drives of the local machine and the unused but available drive letters, select a drive letter for mapping. If there is no available empty drive letter in the system, the "LASTDRIVER=" statement in the CONFIG.SYS file needs to be modified to make there be an available empty drive letter in the system. Move the DRIVEMAP operation bar to the empty drive letter mark (assuming it is F:), press Enter. Select the connection port COM1 for online use and press Enter, then determine which drive of the other machine is connected with the local F drive letter, select and press the O key to return to the previous window, then press the Esc (or x) key to exit the DRIVEMAP interface. After that, the two machines can communicate. Moreover, the two machines can operate independently without affecting each other.
(3) Advantages and disadvantages
Using DRIVEMAP in PCTools 9.0 as the communication software between the two machines has many outstanding advantages: ① The server uses a drive of the client (including the CD-ROM drive) as its own drive. If the environment of the server (memory size, BIOS version, graphics card and monitor, etc.) permits, all executable files on the mapped drive can run; ② After the two machines establish the connection, they can run independently; ③ CD-ROM can be mapped.
The shortcoming of DRIVEMAP is that it can only map one drive of the client. If another drive of the client is to be mapped, the mapped drive must be exited first, and then the drive to be mapped is reselected. In addition, if the connected port needs to be changed, after the change is made, the system must be restarted to take effect.
3. Link of Norton Commander
The Link of Norton Commander also provides the function of online communication, and the specific operation is as follows.
(1) Run NC on the slave machine
At the system prompt, run NC, press F9 key to enter the NC main menu, select the Link item in Left or Right, select COM1, then select Slave, move the cursor to Link and press Enter.
(2) Run NC on the host machine
After running NC on the host machine, also press F9 key to enter the NC main menu, select the Link item in Left or Right, select COM1, then select Master, move the cursor to Link and press Enter. In this way, the two machines are connected, and the data on each drive of the slave machine can be accessed through the left (or right) panel on the host machine.
(3) Advantages and disadvantages
Using NC as the communication software between the two machines, the advantage is that the data on each drive of the slave machine can be accessed, including the CD-ROM. But there are many shortcomings: ① During the communication, the slave machine cannot do any operation; ② On the host machine, only the operation commands provided on the NC panel can be used to operate the data in the mapped drive of the slave machine, and the function is very limited; ③ The executable files on the mapped disk cannot run, and the text files on the mapped disk cannot be edited.
4. INTERLNK Software of DOS
DOS versions above 6.0 provide a program for realizing resource sharing between computers through the parallel port or serial port of the computer, which is INTERLNK and INTERSVR. The former runs on the client, and the latter runs on the server. Whether on the client or the server, the command line must be added to the CONFIG.SYS file: DEVICE=C:\DOS\INTERLNK.EXE. The steps for the client and the server to establish the connection are as follows.
(1) At the system prompt of the machine used as the server, type the INTERSVR command.
(2) Under the condition that the server runs INTERSVR, at the system prompt of the machine used as the client, type the INTERLNK command, and the screen displays the mapping relationship between the empty drive letter of the local machine (client) and the actual drive of the other machine (server). After that, the actual drive of the server can be operated with the empty drive letter of the client.
(3) Advantages and disadvantages
Using the INTERLNK software of DOS to connect and communicate between the two machines, the outstanding advantage is that multiple drive letters can be used on the client to map multiple drives on the server, and the connection port does not need to be set, and INTERLNK will automatically identify the connected port. The shortcomings are: ① During the online period, the server cannot do any other work; ② Network drives and CD-ROM cannot be mapped.
|