Re: C&C Red Alert 3 - Lan (and also hamachi) play

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ThE_TemPLaR wrote:
> Glad that could help ;).
> 
> The combination looks quite difficult to find. I also tried to advertise myself as 255.255.255.255 instead of 0.0.0.0 but the only thing it does was to be able to chat on the lobby while my name appeared twice. When creating a game, everything would go wrong since the others players wouldn't find the guy with this bizarre IP.
> 
> The missing part for me was the little hack.
> 
> I guess "[SOLVED]" can now be prefixed to the title of this thread.
> 
> I would just like to add the code of this hack, in case the HTTP server linked in the tutorial died.
> 
> Filename : bind_hack.c
> 
> Code:
> 
> /* This file is ditributed under the GPLv2 */
> 
> #define _GNU_SOURCE
> 
> #include <sys/socket.h>
> #include <sys/types.h>
> #include <netinet/in.h>
> #include <dlfcn.h>
> #include <string.h>
> 
> int (*real_bind)(int fd, const struct sockaddr* add, socklen_t len);
> 
> void _init(void) {
>     real_bind = dlsym(RTLD_NEXT, "bind");
> }
> 
> int bind(int fd, const struct sockaddr* addr, socklen_t len) {
>     struct sockaddr_in* sa;
> 
>     if(addr->sa_family==AF_INET) {
>         sa = (struct sockaddr_in*) addr;
>         memset(&sa->sin_addr, 0, sizeof(sa->sin_addr));
>     }
>     return real_bind(fd, addr, len);
> }
> 
> 
> 


Solved will certainly be up there!

That hack was smart, and a good technique to bind to all addresses and then managing to get to recv only from the right one. Now I hope wine gets its infraestructure changed to get a new layer on top of the WINSOCK library, to surpass problems like these. I think that a simple linked list could do, but the problem would really be a way to detect which IP we're talking about. And then again I think that we can try and use pointers to pointers, but that changes the whole function....prrrf.

Best thing to do would be to include the bind to device could in the kernel which, AFAIK, won't happen so soon. Maybe a custom kernel build over here will be rolling!!

Anyway, once again, thanks!

Jorl17






[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux