如何获得套接字ID

如何获得套接字ID

本文介绍了如何获得套接字ID /句柄/描述为一个已经打开的连接? (.NET,C ++,Delphi的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是说的称号。究竟是如何做呢?

my question is stated in the title. How exactly do I do that?

我有一个开放的连接,我想劫持,并通过它发送我的自定义信息。从我的理解是与插座和他们的处理程序进行。

I have an open connection and I want to "hijack" it and send my custom messages through it. From my understanding that is done with sockets and their handlers.

任何语言会做,但C#.NET为preferred。

Any language would do but C#.NET is preferred.

感谢您

更新:我究竟想实现我想要实现PostgreSQL的客户保持活动的系统。这意味着让所有的连接开放的PostgreSQL数据库,并每5分钟查询数据库中选择的版本(),以保持连接活着。这就是它。它是用于教育目的的居多。

UPDATE: What exactly am I trying to achieve: I want to implement a keep-alive system for postgresql clients. That means get all the connections open to a postgresql database and every 5 minutes querying the database "select version()" to keep the connection alive. That's about it. It's for educational purposes mostly.

不过,我想用任何类型的连接。

But I want to use this for any kind of connection.

有人吗?想法?没有? :(

Anyone? Ideas? Nothing? :(

推荐答案

该库: SharpPcap 承诺这样做的捕获,注入,分析和利用建筑报文的.NET语言,如C#和VB.NET 的()

This library: SharpPcap promises doing capturing, injecting, analyzing and building packets using any .NET language such as C# and VB.NET (more info)

这是由 Wireshark的库,这是肯定的,它可以捕获和分析。

It is the library used by Wireshark and it is for sure that it can capture and analyze.

这篇关于如何获得套接字ID /句柄/描述为一个已经打开的连接? (.NET,C ++,Delphi的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 08:05