using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; using Sys…
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Net; using System.Net.Sockets; using System.Text; using System.Threading; using Sys…
package server; import java.io.DataOutputStream; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; import java.text.SimpleDateFormat; import java.util.Calendar; public class Server { public Server() { } public static v…
1 常用函数 1.1 socket() int socket(int family, int type, int protocol); socket()打开一个网络通讯端口,如果成功的话,返回一个文件描述符,应用程序可以像读写文件一样用read/write在网络上收发数据,如果socket()调用出错则返回-1.对于IPv4,family参数指定为AF_INET.对于TCP协议,type参数指定为SOCK_STREAM,表示面向流的传输协议.如果是UDP协议,则type参数指定为SOCK_D…