Hello, I have a script that gives the user options of which application to run on a server from a drop down box, then when they pick the option and hit an execute button the script opens a socket connection to a server on the network. The server on the network than runs the application and sends periodic updates back to the client (ex. Stage 1 complete, Stage 2 complete, etc..., Finished). These updates are printed out on a rich edit field. When the execute button is clicked and the socket connection is created the window becomes unresponsive except when a message comes back from the server and is put on the rich edit field. For instance when I hit execute I get a message back pretty quickly that the connection is made and the server has started the application and is on stage 1. However, it takes about 5 minutes for stage 1 to complete and during that time you can't minimize the window, move it, or anything else. And if you go to another app on the computer (IE, Word, email) and then back to the window it won't refresh until another message comes back from the server. This is a very annoying bug. Is there a way around this. I was thinking of using fork() to call the socket connection that way technically it's running on its own and the window remains responsive. I haven't used fork before and I get two problems, the window is still unresponsive waiting for the server to reply, and when I execute an app a second time I get a memory error message but the program still runs and the window is updated as long as I don't click "OK" to terminate the program from the error window. either I'm doing something wrong or fork doesn't work with Win32::GUI (usually when things don't work it's because I'm doing something wrong). Anyone have a way to make this work. I checked the archives and it seems some people have managed to get fork to work but they didn't post the code to show how it's done. Also if there is a way to get this to work without using fork even better. Eventually I will convert the script to an executable using PerlApp from Activestate and I'm not sure how well fork works with that.
Also is it possible to make a Rich Edit Field read only? I don't want the user to be able to add, edit, or delete anything. I just want the application itself to add text to the field. Thanks, Joe Here are the relevant parts of the code: #================== sub XButton_Click { $MainWin->XButton->Disable(); $apppicked = $applist[$Appdropdown->SelectedItem]; print "Execute button clicked, got data: $apppicked\n"; CallServerApp($apppicked); # This calls the function that initiates the socket connection $MainWin->XButton->Enable(); } #================== sub CallServerApp { use IO::Socket; # create the fork() pid if(fork()) { #create socket $sock = new IO::Socket::INET(PeerAddr => 'xxx.xxx.xxx.xxx', PeerPort => someport, Proto => 'tcp' ); die "Socket could not be created. Reason: $!\n" unless $sock; # send the name of the app that the user wants the server to run print $sock $_[0] . "\n"; $sock->flush(); # print the replies from the server about the status of the app to the RichEdit Field while(<$sock>) { $ResponseTF->ReplaceSel($_."\r\n"); $MainWin->Update(); $MainWin->DoEvents(); } close($sock); } return 1; }