Forum: Poser Python Scripting


Subject: Socket communication with external apps

tromnek opened this issue on Mar 11, 2005 ยท 11 posts


tromnek posted Fri, 11 March 2005 at 10:23 AM

Attached Link: http://www.mort.net/users/krm/dist/poser/prpcd132b.zip

I just finished a complete package (still beta) for this project. This will allow you to load poser library files from any application that supports the standard windows (right-click) 'Send To' context menu. In the archive is: prpcd???.py - A server daemon that listens on a tcp/ip socket for incomming filenames. snd2sock??.exe - A windows executable (as per hogwarden's advice) that implements the 'Send To' context menu. client???.py - A client module for the server that will filter poser (pz2, p2z) files and apply only translation and rotation parameters to the selected body parts.

instructions are in the readme file.
thanks, let me know what you think


Indoda posted Sat, 12 March 2005 at 6:44 AM

Hi Tromnek It worked for me and it certainly helps with quick loading through Explorer. What is the difference between this script and the one for P3D Explorer in terms of safety? Not sure what I'm trying to say but I had to turn loop back on in my firewall and allow the exe to have access to the port etc. It's a while since I read any C code too ;) Thanks for sharing your talents.

The important thing is not to stop questioning.
- Albert Einstein

Indoda


tromnek posted Sat, 12 March 2005 at 10:35 AM

There are two main components of both this package and the P3do plugin (i'll assume you are using the 'extended' plugin that allows remote python script execution).

  1. A server listens for filenames to be loaded into the poser scene.

  2. An external program sends filenames to the server.

You can use the new server (prpcd132b.py) with P3dO instead of the 'PoserPythonReceiver.py' that was in the plugin package. This new server now provides support for running additional python scripts that have a GUI interface(loaded remotely or with the Poser menu) while the server is running. It also allows client modules to be loaded (I included a demo client module, client132b.py).
The security concerns between the new server and the 'extended' one in the P3dO plugin are identical.

The 'socket03b.exe' program is an alternative to the P3dO plugin;
'PoserPythonSender.exe' + 'PoserPythonSender.py'
This program is quicker (maybe .5 seconds), and makes it easier to implement a 'Send To' context menu.
You can continue to use the orginal P3dO plugin sending ability and it will communicate with the new server (prpcd132.py) just fine.

Your firewall issue. (What one are you using?)
My guess is that your personal firewall see's an outbound tcp/ip connection initiated from an .exe file as a possible threat (and rightfully so).
However, it should have also questioned that same connection when it was initiated by the the P3dO plugin. It probably didn't see it as a threat because in the plugin the connection is initiated by a dll (python22.dll) not an .exe and your firewall was (falsely) assuming the connection was safe.

The best solution is to define an exception in your firewall for socket03b.exe to all outbound connections from ip 127.0.0.1 to ip 127.0.0.1 port 49160
This is safer than disabling your firewall.
Did you try the client module? It's really neat.


Indoda posted Sat, 12 March 2005 at 11:17 AM

Oh that is neat - took it for a spin after breakfast I can see myself using that often. I think I'm sorted out now - I use Outpost Pro 2.5 as my firewall so I had to turn on the loopback and then it created the exceptions for the .exes. So I can use the new plugin with PD3 too? Thank you once again - I'm having fun this morning!

The important thing is not to stop questioning.
- Albert Einstein

Indoda


tromnek posted Sat, 12 March 2005 at 12:17 PM

Yes, use the new server (prpcd132b.py) with P3dO, that's what I do. The snd2sock03b.exe is mainly for use without P3dO.


Indoda posted Sat, 12 March 2005 at 1:09 PM

Thanks again - using PD3 for browsing all my content is much easier than the P5 palette. Great stuff. Now if only I could find that make art button everyone talk about ;)

The important thing is not to stop questioning.
- Albert Einstein

Indoda


tromnek posted Sat, 19 March 2005 at 3:55 PM

Another neat thing that this stuff allows is dereferencing of windows shortcuts (.lnk). I started creating sub-directories for each of my characters that has;

01baseM3withExpressions.lnk
02headmorph.pz2
02bodymorph.pz2
03materials.pz2
04hair.lnk
06M3tunic.lnk

I can select all those files in explorer (or P3dO) then sendem all to poser. While poser is loading them all, I can navagate to another directory and find the next things I want to use.


Indoda posted Sat, 19 March 2005 at 4:42 PM

Thanks for this script Tromnek it's a marvel. I have rearranged my Poser libraries too and made them make more sense to me not to Poser. This week I have used the script and PD3 everyday when using Poser. Only had one hang and that was my fault for not checking a new item for wayward paths ;) There was some 38 wrong references! Now if we could just have a script to transfer all the morph settings from a character to its clothes with the dials all set correctly and then of course that always sought after button "Make Art" Have a good weekend. Indoda

The important thing is not to stop questioning.
- Albert Einstein

Indoda


tromnek posted Sat, 19 March 2005 at 9:02 PM

Attached Link: http://www.renderosity.com/messages.ez?ForumID=12390&Form.ShowMessage=2159729

For the clothing morph settings check this thread. I don't know anything about the 'Make Art' thingy.

Indoda posted Thu, 24 March 2005 at 3:34 PM

Thanks again Ken FYI I have used the script for the last three days with P6!! All works fine. Time to upgrade it from beta status? I just love using P3D to add the chars etc to Poser. Makes me want to start learning Python ;) I'm getting too old LOL. I started back in '81 with Basic and then C before Windows. VB, Lingo, ActionScript 2 etc. How difficult is Python? Indoda

The important thing is not to stop questioning.
- Albert Einstein

Indoda


tromnek posted Sat, 26 March 2005 at 10:04 AM

Thanks, I was hoping it would. I'm waiting on a physical shipment. I have one more change to the client module registration protocol before I move it out of beta. Python is not bad. The nice thing about it is that you can program 'Top down', 'Proceedural' or 'Object Oriented'. It's also easy to migrate a program from top-down to procedural and procedural to oop. So you can program it however you are comfortable for a particular task. It's real handy for programming little utilities and the 'regular expressions' make text processing really easy.