Archive: Can NSIS listen to a port ?


Can NSIS listen to a port ?
Is it possible for NSIS to listen to a port and respond ?

After my main app starts running, I wanted to run nsis in the background...and pop up if need be
is this possible ?
g


I think you'd need to write a plugin to do this. I'm not aware of any existing plugins that do this. Feel free to check the Wiki though.

-Stu


I spent a little time looking at Nopey which calls netcat
Is this a clue ?
many thanks
g


Netcat:
http://netcat.sourceforge.net/
Not sure if that'll do what you need though.

I found this also which is probably better:
http://www.petri.co.il/quickly_find_...open_ports.htm

-Stu


thanks :)
I'll take a look
;
What I would like to do...or something equivalent:
my locally run main application sends an http request which the locally run nsis app with netcat/PORTQRY.EXE is listening for....
;
If the nsis exe hears the request, then it does something
Am I dreaming here ?
many thanks
g

would be my first plugin attempt
g


You could put NSIS into an infinite loop which has a Sleep 2000 (say) and will exit the loop only if [something] occurs.

That [something] could be if it hears the request. I'm not sure how you'd get that to work - maybe portqry has that feature too?

Edit: I thought portqry.exe was part of Windows, but it's not. Therefore it must be part of Netcat...

-Stu


Here's another one:
http://www.netdemon.net/help/listener.html (http://www.netdemon.net/help/index.html)

One written in Java:
http://patriot.net/~tvalesky/portlistener.html

This is a good page on socket programming in C++:
http://www.ecst.csuchico.edu/~beej/guide/net/html/

-Stu


thanks Stu :)

I'll check it out

g


grahama, please note that you should allow incoming connection for this application on all users systems (XP and 2003 firewalls problem). This is why most of ftp clients work in 'passive' mode. May be a bit annoying for users. If this is OK, you can write a simple code: socket-bind-listen-(poll-)accept-recv (or use one of MFC cserversocket samples) and everything will be OK :)


thanks Takhir
this should help out...as I may be writing my first plugin
are there any 'Hello World' type dll tutorials to get started?

g


Just take one of simple plug-ins (like userinfo) and replace it's code. Change output file name (project properties, Link), rebiuld. VS 6 may require for dsw workspace.


ExDll is the best platform to use. Make a copy of the DSP, C, and DSW files to your new project folder and call them all <myDllName>.ext. Then you need to open them all up in Notepad and replace all the ExDll with <myDllName>. Finally, add #include "..\ExDll\exdll.h" into your new <myDllName>.c at the top (replace #include "exdll.h").

-Stu


thanks again :)
might even be fun

g


I think I finally have the time to approach this...
;
If my app sends out a generic string to "127.0.0.1:8181" or some other random port, my plugin will need to:
;
"socket-bind-listen-(poll-)accept-recv (or use one of MFC cserversocket samples) and everything will be OK ."
;
Is there a half finished plugin out there that attempts this ?
I'll start doing my homework :)
;
g