【发布时间】:2015-03-25 04:41:28
【问题描述】:
我创建了一个新表单,在顶部我做了:
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);
在 new TcpListener(8888) 下,我看到绿线,警告是:
警告 4 'System.Net.Sockets.TcpListener.TcpListener(int)' is obsolete: '"此方法已被弃用。请改用 TcpListener(IPAddress localaddr, int port)。
尝试谷歌,但我没有找到任何解决方案。 尝试做:new TcpListener(8888,21) 可能使用端口,但这不是解决方案。
【问题讨论】:
-
我猜向下滚动到example 太多了?
-
如果这个例子像@Bull Durham 的答案一样苗条,那会有所帮助
标签: c# .net winforms sockets networking