如题 附上一个图来说明问题 求高手解决下
添加item的代码是
添加item的代码是
public void SetListBox(string str,Socket s)
{
//在listview中插入新条目?插入数据
string[] infostring = str.Split(",");
ListViewItem item = new ListViewItem();
item.SubItems.Add(infostring[0]);
item.SubItems.Add(infostring[1]);
meg_listView.Items.Add(item);
//获取该条目的索引
int index = meg_listView.Items.IndexOf(item);
//SocketAsyncEventArgs socketargs = e;
//将SocketAsyncEventArgs加入字典中
SetSocketArgsDitc(index,s);
}
解决方案
30
[::ffff:127.0.0.1]:35115是IPv6的表达方式,假如一定转成IPv4的表达方式,可以用以下办法:
IPEndPoint ep = (IPEndPoint)s.RemoteEndPoint;
IPAddress ipv4 = ep.Address.MapToIPv4();
Console.WriteLine(“{0}:{1}”, ipv4, ep.Port);
IPEndPoint ep = (IPEndPoint)s.RemoteEndPoint;
IPAddress ipv4 = ep.Address.MapToIPv4();
Console.WriteLine(“{0}:{1}”, ipv4, ep.Port);