Results 1 to 14 of 14

Thread: sendbroadcast packets to all interface?

  1. #1

    Thread Starter
    Banned
    Join Date
    Jun 2022
    Posts
    149

    sendbroadcast packets to all interface?

    WinIPBroadcast is a small program that allows Windows applications to send global IP broadcast packets (destination address 255.255.255.255) to all interfaces instead of just the preferred one.
    this can do it tested it https://github.com/dechamps/WinIPBroadcast
    please anyone how do i do this with vb6 maybe winsock chat or multi server winsock or maybe simple project with winsock

    https://tangentsoft.net/wskfaq/inter...html#broadcast
    Last edited by jenniger9; Jul 3rd, 2022 at 09:22 PM.

  2. #2
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: sendbroadcast packets to all interface?

    You have the entire C source code showing you how to do it. Just translate it to VB6. The only part you cannot replicate is the plumbing that makes it capable of being a Windows Service but you can work around that.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  3. #3

    Thread Starter
    Banned
    Join Date
    Jun 2022
    Posts
    149

    Re: sendbroadcast packets to all interface?

    Quote Originally Posted by Niya View Post
    You have the entire C source code showing you how to do it. Just translate it to VB6. The only part you cannot replicate is the plumbing that makes it capable of being a Windows Service but you can work around that.
    hi niya. i don't know how to translate it this is why i needed help.

  4. #4
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: sendbroadcast packets to all interface?

    This isn't a trivial amount of code. Just the Winsock imports alone is a couple hours work unless someone has already written them out. The rest of it.......just work and not to mention testing to make sure it all works correctly. I'm usually the kind one but I don't have that kind of time right now.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  5. #5

    Thread Starter
    Banned
    Join Date
    Jun 2022
    Posts
    149

    Re: sendbroadcast packets to all interface?

    if anybody can help with this will be greatfull

  6. #6
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Re: sendbroadcast packets to all interface?

    Quote Originally Posted by Niya View Post
    You have the entire C source code showing you how to do it. Just translate it to VB6. The only part you cannot replicate is the plumbing that makes it capable of being a Windows Service but you can work around that.
    Why wouldn't you be able to be a service?

  7. #7
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: sendbroadcast packets to all interface?

    Quote Originally Posted by fafalone View Post
    Why wouldn't you be able to be a service?
    If the VB6 compiler can export the entry point ServiceMain it might be possible. I don't know if it can.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  8. #8
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: sendbroadcast packets to all interface?

    Quote Originally Posted by Niya View Post
    If the VB6 compiler can export the entry point ServiceMain it might be possible. I don't know if it can.
    NSSM FTW!

  9. #9
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: sendbroadcast packets to all interface?

    Quote Originally Posted by peterst View Post
    I'm aware of this method. I've used SrvAny in the distant past to run VB6 applications as services which is the workaround I alluded to. But the C source that OP posted is an actual Windows Service. I'm not sure translating that part of it to VB6 would work.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  10. #10
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Re: sendbroadcast packets to all interface?

    Isn't it just passing the address of the functions as callbacks? I don't even see any multithreading with that method, not that it's not fairly easy to do that in VB6 these days... this demo suggests it's easy enough to run a service with VB6 with a separate thread.

    Isn't exporting for DLL-based services running under svchost, rather than an exe acting as a service?

  11. #11

    Thread Starter
    Banned
    Join Date
    Jun 2022
    Posts
    149

    Re: sendbroadcast packets to all interface?

    Quote Originally Posted by fafalone View Post
    Isn't it just passing the address of the functions as callbacks? I don't even see any multithreading with that method, not that it's not fairly easy to do that in VB6 these days... this demo suggests it's easy enough to run a service with VB6 with a separate thread.

    Isn't exporting for DLL-based services running under svchost, rather than an exe acting as a service?
    this tool is command line tool you need to execute app.exe run using windows cmd and it remains still working in background.
    what does this do.
    main goal is to host server /join multiplayer on lan.
    now when i run a multiplayer game on vmware and host a game the main pc running the same game while in multiplayer section you cannot see the hosted game.
    running that tool leaving it running then going back in game in main pc in multiplayer section you can see the game hosted by the vmware.

    test 2
    vmware being client looking for hosted games running this tool and main pc being host,vmware is unable to see the main pc hosted game.

  12. #12
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    8,598

    Re: sendbroadcast packets to all interface?

    Quote Originally Posted by fafalone View Post
    Isn't it just passing the address of the functions as callbacks? I don't even see any multithreading with that method, not that it's not fairly easy to do that in VB6 these days... this demo suggests it's easy enough to run a service with VB6 with a separate thread.

    Isn't exporting for DLL-based services running under svchost, rather than an exe acting as a service?
    Actually upon more detailed examination of the C code, it might actually be possible to run this as a service in VB6. Look at this:-
    Code:
    SERVICE_TABLE_ENTRY dispatchTable[] = 
    	{
    		{ SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION)serviceMain },
    		{ NULL, NULL }
    	};
    	
    	mainThread = NULL;
    	serviceStatus = NULL;
    
    	if (!StartServiceCtrlDispatcher(dispatchTable))
    	{
    		if (GetLastError() != ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
    			systemError(TEXT("StartServiceCtrlDispatcher"), TRUE);
    	}
    	else
    		return 0;
    The above can be found in the standard entry-point into the application. It looks as if the Service Control Manager calls this entry point just like as the OS would call it for a normal EXE only when it's called from the SCM, StartServiceCtrlDispatcher(dispatchTable) would succeed which would then call ServiceMain as a callback which actually starts the service.

    So a standard Sub Main() in VB6 could actually work. I don't know though. Even in VB6's hayday, people weren't rushing to write Windows Services in it so I have to believe it's not as easy as it would to do as it would be in C. The SCM may be executing callbacks on different threads and this tends to make VB6 applications misbehave. Also, the Microsoft docs state that Windows Services are actually Console applications and VB6 can't make those by default.

    All in all, it's probably better to avoid all this headache and use something like SrvAny to run a VB6 application as a service.
    Last edited by Niya; Jul 6th, 2022 at 03:29 AM.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  13. #13
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,647

    Re: sendbroadcast packets to all interface?

    Yeah that's what I was thinking... the C code isn't running multiple threads, and doesn't appear to be a DLL where the function is exported. And callbacks where you pass a function pointer to an API work in most other situations.

    The project I linked is a service implemented in VB6 with a separate controller and main service... but it's calling CreateThread so that introduces some limits to what you can do and APIs have to be in a TLB (though using something like The trick's multithreading module should get around that). I haven't tested it though.

    All in all, it's probably better to avoid all this headache and use something like SrvAny to run a VB6 application as a service.
    Who uses VB6 still and isn't interested in pushing it's boundaries?

  14. #14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width