perl编写tcp socket通讯服务端代码

代码语言:perl

所属分类:文件

代码描述:perl编写tcp socket通讯服务端代码

代码标签: socket 通讯服务

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

#!/usr/bin/perl -w
# Filename : server.pl

use strict;
use Socket;

# use port 7890 as default
my $port = shift || 7890;
my $proto = getprotobyname('tcp');
my $server = "localhost";  # Host IP running the server

# create a socket, make it reusable
socket(SOCKET, PF_INET, SOCK_STREAM, $proto)
   or die "Can't open soc.........完整代码请登录后点击上方下载按钮下载查看

网友评论0