修改网络信息获取方式
This commit is contained in:
commit
df7bc3bae6
1 file changed
+2
-1
@@ -11,6 +11,7 @@ using System.Windows.Forms;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
|
||||||
namespace formula_manage.UserClass
|
namespace formula_manage.UserClass
|
||||||
{
|
{
|
||||||
@@ -39,7 +40,7 @@ namespace formula_manage.UserClass
|
|||||||
listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
|
||||||
|
|
||||||
//第二步:给已经创建的套接字绑定一个端口号,这一般通过设置网络套接口地址和调用Bind()函数来实现
|
//第二步:给已经创建的套接字绑定一个端口号,这一般通过设置网络套接口地址和调用Bind()函数来实现
|
||||||
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("127.0.0.1"), int.Parse("11080"));
|
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(UserClass.get_local_ip_address.getLocalIPAddressWithNetworkInterface(NetworkInterfaceType.Ethernet)), int.Parse("11080"));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user