我创建了一个新表单,在顶部我做了:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using System.Collections;
using System.Net.Sockets;
namespace mws
{
public partial class Chat : Form
{
TcpListener serverSocket = new TcpListener(8888);
在新的 TcpListener(8888) 下,我看到绿线,警告是:
警告 4“System.Net.Sockets.TcpListener.TcpListener(int)”已过时:“此方法已被弃用。请改用 TcpListener(IPAddress localaddr, int port)。
尝试谷歌但我没有找到任何解决方案。
尝试这样做: new TcpListener(8888,21) 也许使用端口,但这不是解决方案。
var serverSocket = new TcpListener(IPAddress.Any, 8888);
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)