-
-
[未解决,已结帖]
[求助]自己写的lsp socks5搞游戏加速,目前卡在udp上了,不求帮写代码,求思路和错误
1000.00雪花
-
发表于:
2018-6-27 15:24
14002
-
[未解决,已结帖] [求助]自己写的lsp socks5搞游戏加速,目前卡在udp上了,不求帮写代码,求思路和错误
1000.00雪花
背景:
自己写的游戏加速器,tcp走网页,客户端,游戏是ok的,
udp也是走了socks5来搞,自己测试udp是代理上的,但是启动lol之后,在进游戏界面会提示连接服务器失败;
使用了win sdk demo中的代码,https://github.com/pauldotknopf/WindowsSDK7-Samples/tree/master/netds/winsock/lsp
其中udp和tcp我增加的部分我写在了下面:
补充下:用的是ss的本地客户端自带的socks5,因此在udp中省略了协商的过程,发现上传的代码中少了lspdef.h中的部分结构,现补充
typedef struct _ASYNC_INFO {
HWND hWnd;
unsigned int wMsg;
long lEvent;
} ASYNC_INFO;
typedef struct _EVENT_INFO {
WSAEVENT hEventObject;
long lNetworkEvents;
} EVENT_INFO;
typedef struct _SOCK_OPT {
int level;
int optname;
const char FAR * optval;
int optlen;
} SOCK_OPT;
typedef struct _IO_CTL {
LPVOID lpvInBuffer;
DWORD cbInBuffer;
LPVOID lpvOutBuffer;
DWORD cbOutBuffer;
LPDWORD lpcbBytesReturned;
LPWSAOVERLAPPED lpOverlapped;
LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine;
LPWSATHREADID lpThreadId;
} IO_CTL;
typedef struct _SOCK_INFO
{
SOCKET ProviderSocket; // lower provider socket handle
SOCKET LayeredSocket; // app's socket handle
DWORD dwOutstandingAsync; // count of outstanding async operations
BOOL bClosing; // has the app closed the socket?
volatile LONG RefCount; // How many threads are accessing this info?
BOOL isUdp;
ULONG BytesSent; // Byte counts
ULONG BytesRecv;
HANDLE hIocp; // associated with an IOCP?
int LastError; // Last error that occured on this socket
HWND hWnd; // Window (if any) associated with socket
UINT uMsg; // Message for socket events
CRITICAL_SECTION SockCritSec; // Synchronize access to this object
PROVIDER *Provider;// Pointer to the provider from which socket was created
LIST_ENTRY Link;
UINT blockingType; // socket bolckingType 0: blocking; 1:eventSelect; 2:asyncSelect
ASYNC_INFO asyncSelectInfo; // save socket asyncSelect handle
EVENT_INFO eventSelectInfo; // save socket eventSelect handle
int* Nonblock; // socket bolcking type
SOCK_OPT opt; // set socket opt params
bool optState; // is opt
bool proxyState; // use for udp; only udp sendto called set be true;then call recvfrom will check this value
const struct sockaddr FAR * RemoteAddr; // for udp called: connect->send->recv
bool isConnected; // check a socket is connected
IO_CTL ioctl; // wsaioctl params
bool UdpTunnelReady; // udp tunnel is ready
} SOCK_INFO;
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!
最后于 2018-6-28 11:07
被justDoItMe编辑
,原因: 增加说明和补充头文件