Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 17:48

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 
Author Message
 Post subject: MyProxocket Packet size limiting
PostPosted: 21 Sep 2010 12:35 

Joined: 21 Jun 2010 16:27
Posts: 9
I've been looking for function to limit the size of the incoming packets by myproxcet. I need this, if size of incoming packet is smaller than 1024 bytes, pass it to the main program, if size is larger than 1024 bytes, drop the packet so it doesn't reach the program? Aluigi or anyone, any suggestions? :)


Top
 Profile  
 
 
 Post subject: Re: MyProxocket Packet size limiting
PostPosted: 21 Sep 2010 13:59 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
the following returns a packet of zero bytes if it's bigger than 1024:
Code:
#include <stdlib.h>
#include <string.h>
#include <winsock.h>
#include <windows.h>


int __cdecl myrecvfrom(SOCKET s, u_char *buf, int len, int flags, struct sockaddr *from, int *fromlen) {
    if(len > 1024) len = 0;
    return(len);
}


BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) {
    if(fdwReason == DLL_PROCESS_ATTACH) DisableThreadLibraryCalls(hinstDLL);
    return(TRUE);
}


Top
 Profile  
 
 Post subject: Re: MyProxocket Packet size limiting
PostPosted: 21 Sep 2010 16:25 

Joined: 21 Jun 2010 16:27
Posts: 9
thanx for response, I tried to compile it, done it...placed in server folder and it does nothing :S it worked before when I used it as players-limiter. Could you plase compile it for me if you have a few free minutes?
thank you very much :)


Top
 Profile  
 
 Post subject: Re: MyProxocket Packet size limiting
PostPosted: 21 Sep 2010 16:41 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
attached


Attachments:
udp1024.zip [2.92 KiB]
Downloaded 48 times
Top
 Profile  
 
 Post subject: Re: MyProxocket Packet size limiting
PostPosted: 21 Sep 2010 19:07 

Joined: 21 Jun 2010 16:27
Posts: 9
thank you very much :D works finally ^^
last question, is it possible to combine it with the playerslimiter because I find them both very useful? :)


Top
 Profile  
 
 Post subject: Re: MyProxocket Packet size limiting
PostPosted: 22 Sep 2010 19:51 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
eh no, the only way it to "merge" the 2 patches and recompiling the obtained myproxocket.c.
note that except for cygwin, any other compiler is able to build myproxocket.dll correctly.
if you have doubts try mingw: gcc -o myproxocket.dll myproxocket.c -shared


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 6 posts ] 

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: