我该如何解决有关 TcpListener 的警告:请改用 TcpListener(IPAddress localaddr, int port)?
How can i solve the warning about TcpListener: Please use TcpListener(IPAddress localaddr, int port) instead?
我创建了一个新表格并在顶部做了:
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)。
尝试 google 但我没有找到任何解决方案。
尝试做:new TcpListener(8888,21) 可能使用一个端口,但这不是解决方案。
var serverSocket = new TcpListener(IPAddress.Any, 8888);
我创建了一个新表格并在顶部做了:
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)。
尝试 google 但我没有找到任何解决方案。 尝试做:new TcpListener(8888,21) 可能使用一个端口,但这不是解决方案。
var serverSocket = new TcpListener(IPAddress.Any, 8888);