VentureOnline 49 Posted February 15, 2015 Report Share Posted February 15, 2015 Just gotta say this is by far the best plugin ive ever used for uBot. Excellent work! Quick question as far as multithreading and server connections go. I have a PHP script that is calling uBot with multi requests at the same time. So lets just say for example im using uBot to create Tumblr accounts. Now I launch the same PHP script multiple times but sending different account information each time. The PHP scripts are calling the same bot at the same time opening new threads on the bot for each PHP connection. I need uBot to return the correct account information to the correct PHP connection that spawned the thread. I just want to clarify, if I put each thread inside the "Lock" command will that lock that thread to the same PHP connection that spawned the thread? So since its the same PHP script calling the same define launching multithreads will the Lock command be able to know which php connection belongs to which thread? Hopefully you understand what I mean by this. Link to post Share on other sites
Pete_UK 9 Posted February 15, 2015 Report Share Posted February 15, 2015 Is there a way to test if a server is running so I can display an alert if not, instead of getting the 'Unable to connect to remote server' message? Link to post Share on other sites
Bot-Factory 602 Posted February 15, 2015 Report Share Posted February 15, 2015 Is there a way to test if a server is running so I can display an alert if not, instead of getting the 'Unable to connect to remote server' message? Not at the moment. But I already asked DW for this feature. And I think he has it on the list.Dan 1 Link to post Share on other sites
diskwizz 24 Posted February 15, 2015 Report Share Posted February 15, 2015 (edited) That was the golden nugget of information I was looking for But that should also be explained in the example you receive with it. Just gotta say this is by far the best plugin ive ever used for uBot. Excellent work! Quick question as far as multithreading and server connections go. I have a PHP script that is calling uBot with multi requests at the same time. So lets just say for example im using uBot to create Tumblr accounts. Now I launch the same PHP script multiple times but sending different account information each time. The PHP scripts are calling the same bot at the same time opening new threads on the bot for each PHP connection. I need uBot to return the correct account information to the correct PHP connection that spawned the thread. I just want to clarify, if I put each thread inside the "Lock" command will that lock that thread to the same PHP connection that spawned the thread? So since its the same PHP script calling the same define launching multithreads will the Lock command be able to know which php connection belongs to which thread? Hopefully you understand what I mean by this.No a lock is not designed to lock and identify a connection, to see what locks are and what they do check the how to out. What you want though is of course possible, check out the code below. http://i.imgur.com/vD3i7HN.pngdefine DefineToBeCalledByPHP(#context) { set(#requestData,$plugin function("Communication.dll", "$get request data", #context),"Local") comment("All work done here makes the client sending the request wait") plugin command("Communication.dll", "return response", #context, "Received data") comment("After we return response the connection will close") comment("So all work done after return response will not make the client wait") comment("Here we do some fictional work") set(#workData,"data that needs to be send to the php server","Local") comment("Here we send the data gatherd by the work back to the php server") set(#requestResponse,$plugin function("Communication.dll", "$send server request", "http://myserver.tld/reportworkdata.php", #workData),"Local") comment("Possibility\'s for keeping a track of the work is giving it a id with which php can identify it.For example a id from a database record.")} Is there a way to test if a server is running so I can display an alert if not, instead of getting the 'Unable to connect to remote server' message?If it would return a text containing "-1" or "unable to connect" from the function itself would that be enough? Edited February 15, 2015 by diskwizz Link to post Share on other sites
Bot-Factory 602 Posted February 15, 2015 Report Share Posted February 15, 2015 true if connection is successfulfalse if not Because if it returns true when it's successful we could directly do: if($plugin function("Communication.dll", "$send request", "192.99.44.22", 8080, "xxx", "aaa")) { then { alert("working") } else { alert("not working") }} If you return a different text, we would have to work with the comparison function. Which would make the code a bit more complicated. ThanksDan Link to post Share on other sites
diskwizz 24 Posted February 15, 2015 Report Share Posted February 15, 2015 true if connection is successfulfalse if not Because if it returns true when it's successful we could directly do: if($plugin function("Communication.dll", "$send request", "192.99.44.22", 8080, "xxx", "aaa")) { then { alert("working") } else { alert("not working") }} If you return a different text, we would have to work with the comparison function. Which would make a bit more complicated. ThanksDanIt cannot respond with true because it responds with the response from whoever you did the request to. Link to post Share on other sites
Pete_UK 9 Posted February 15, 2015 Report Share Posted February 15, 2015 ... If it would return a text containing "-1" or "unable to connect" from the function itself would that be enough? true if connection is successfulfalse if not Because if it returns true when it's successful we could directly do: if($plugin function("Communication.dll", "$send request", "192.99.44.22", 8080, "xxx", "aaa")) { then { alert("working") } else { alert("not working") }} If you return a different text, we would have to work with the comparison function. Which would make the code a bit more complicated. ThanksDan I think returning a specific text string like '-1' or "unable to connect" would be best because a true/false would conflict with the existing structure of the function. It currently return what ever the server send back - if I understand it right. Link to post Share on other sites
diskwizz 24 Posted February 15, 2015 Report Share Posted February 15, 2015 (edited) I think returning a specific text string like '-1' or "unable to connect" would be best because a true/false would conflict with the existing structure of the function. It currently return what ever the server send back - if I understand it right.Yes, it responds back whatever the server sends back. So you could check if the response does not equals -1 and run your script. If it then does equal -1 you know there is a error. Edited February 15, 2015 by diskwizz Link to post Share on other sites
diskwizz 24 Posted February 15, 2015 Report Share Posted February 15, 2015 I will add it in a update later today that it returns "-1" if there was a error on the $send request. So that you know the server is not running or cannot be reached. Link to post Share on other sites
Bot-Factory 602 Posted February 15, 2015 Report Share Posted February 15, 2015 Or add a check remote running function that returns true/false Link to post Share on other sites
Pete_UK 9 Posted February 15, 2015 Report Share Posted February 15, 2015 Another nice addition would be to return a similar message if the connection to the server is lost after connection. Link to post Share on other sites
diskwizz 24 Posted February 15, 2015 Report Share Posted February 15, 2015 (edited) Ok so right now if there is a error it will respond like in the image below. http://i.imgur.com/jcaihxK.pngTo work with that i added "$starts with" and "$ends with". These are Qualifier Functions and return "true" or "false". Basically it checks if a given text starts or ends with a certain text. The new functions are shown here below.http://i.imgur.com/xeKlKhN.pngHere is a small example of how to use it.http://i.imgur.com/kgyI2ws.pngJust let me know what you guy's think about it. Edited February 15, 2015 by diskwizz Link to post Share on other sites
Bot-Factory 602 Posted February 15, 2015 Report Share Posted February 15, 2015 Couldn't we just use:If.. contains "error:Unabel to connect to" Or why do we need a new function here? Link to post Share on other sites
diskwizz 24 Posted February 15, 2015 Report Share Posted February 15, 2015 Couldn't we just use:If.. contains "error:Unabel to connect to" Or why do we need a new function here?Because there can be different error messages describing you whats wrong. There can be more wrong then just "Unable to connect", like "Unable to resolve domain" etc. The function "$contains" looks trough all the code and this functions just at the beginning of the text. Link to post Share on other sites
Pete_UK 9 Posted February 15, 2015 Report Share Posted February 15, 2015 i'm good with that. Link to post Share on other sites
Pete_UK 9 Posted February 15, 2015 Report Share Posted February 15, 2015 (edited) When a server bot is called it could take quite a long time to run. In my testing I am seeing a timeout at around the 100 seconds if the server does not respond in that time frame. Is there a way to increase / decrease the Timeout period?Is there a way to keep the connection alive? This is the scenario I have... Controller bot loops through a list of URL's and calls a server bot for each url in the listThe Server bot can some time takes 10 seconds to do it processing before returning the results to the controller. But other times it could take 5 mins or 10 mins etc..So anything above the 100 seconds limit i am seeing at the moment causes a time out error and the link between controller and server is broken.I have additional follow-on processes where the controller will call other server bots afterwards. Can you give some advise on how I can handle this? Thanks,Pete Edited February 15, 2015 by Pete_UK Link to post Share on other sites
Pete_UK 9 Posted February 15, 2015 Report Share Posted February 15, 2015 (edited) Is there a way to have a controller bot run a server bot multiple times simultaneously, passing data as needed ? EDIT: After watching some of the videos again... I guess this is where the Dynamic Worker bot scenario comes in, right? Edited February 15, 2015 by Pete_UK Link to post Share on other sites
VentureOnline 49 Posted February 15, 2015 Report Share Posted February 15, 2015 Hey thanks for the explanation! Would be great if the threading could keep track of the PHP connection in the same way a browser with multiple tabs can. Not sure how difficult this would be to implement but it would be great option so that a PHP could launch and finish the task as if uBot was just an extension of the PHP script. As it is now its fine for some tasks but for certain tasks that require a PHP connection to return a value from the same script it requires constant looping to wait to find the correct returned file or database entry to return the correct info. With that said this is an amazing plugin, just a thought of a useful addition that could be added. But that should also be explained in the example you receive with it. No a lock is not designed to lock and identify a connection, to see what locks are and what they do check the how to out.What you want though is of course possible, check out the code below. http://i.imgur.com/vD3i7HN.pngdefine DefineToBeCalledByPHP(#context) { set(#requestData,$plugin function("Communication.dll", "$get request data", #context),"Local") comment("All work done here makes the client sending the request wait") plugin command("Communication.dll", "return response", #context, "Received data") comment("After we return response the connection will close") comment("So all work done after return response will not make the client wait") comment("Here we do some fictional work") set(#workData,"data that needs to be send to the php server","Local") comment("Here we send the data gatherd by the work back to the php server") set(#requestResponse,$plugin function("Communication.dll", "$send server request", "http://myserver.tld/reportworkdata.php", #workData),"Local") comment("Possibility\'s for keeping a track of the work is giving it a id with which php can identify it.For example a id from a database record.")} Link to post Share on other sites
diskwizz 24 Posted February 15, 2015 Report Share Posted February 15, 2015 When a server bot is called it could take quite a long time to run. In my testing I am seeing a timeout at around the 100 seconds if the server does not respond in that time frame. Is there a way to increase / decrease the Timeout period?Is there a way to keep the connection alive? This is the scenario I have... Controller bot loops through a list of URL's and calls a server bot for each url in the listThe Server bot can some time takes 10 seconds to do it processing before returning the results to the controller. But other times it could take 5 mins or 10 mins etc..So anything above the 100 seconds limit i am seeing at the moment causes a time out error and the link between controller and server is broken.I have additional follow-on processes where the controller will call other server bots afterwards. Can you give some advise on how I can handle this? Thanks,PeteThis new update should solve your issue.http://i.imgur.com/MZURH2p.png Hey thanks for the explanation! Would be great if the threading could keep track of the PHP connection in the same way a browser with multiple tabs can. Not sure how difficult this would be to implement but it would be great option so that a PHP could launch and finish the task as if uBot was just an extension of the PHP script. As it is now its fine for some tasks but for certain tasks that require a PHP connection to return a value from the same script it requires constant looping to wait to find the correct returned file or database entry to return the correct info. With that said this is an amazing plugin, just a thought of a useful addition that could be added.Could you send me a code snippet that demonstrates the current limitation? Perhaps I'm understanding you wrong but some code would help me to see what you mean. Link to post Share on other sites
diskwizz 24 Posted February 15, 2015 Report Share Posted February 15, 2015 Is there a way to have a controller bot run a server bot multiple times simultaneously, passing data as needed ? EDIT: After watching some of the videos again... I guess this is where the Dynamic Worker bot scenario comes in, right? Yes, with the dynamic worker bot scenario you can start a "mindless" bot so to say, that reads the parameter you send it and executes the raw Ubot code. Link to post Share on other sites
Pete_UK 9 Posted February 16, 2015 Report Share Posted February 16, 2015 This new update should solve your issue.http://i.imgur.com/MZURH2p.png Perfect. Yes, with the dynamic worker bot scenario you can start a "mindless" bot so to say, that reads the parameter you send it and executes the raw Ubot code. Thought so. Thanks for confirming. A tip of my hat to you for making this plugin. Opens up so many doors. And the support.... outstanding! Link to post Share on other sites
Bliss 194 Posted February 16, 2015 Author Report Share Posted February 16, 2015 Update: V2.6.3.1 Please download the update from Jvzoo http://customer.jvzoo.com Version 2.6.3.1Added: $start with, returns "true" or "false" if a text starts with a given textAdded: $ends with, returns "true" or "false" if a text ends with a given textUpdated: $send request, has now a timeout parameterUpdated: $send server request, has now a timeout parameterUpdated: $send request, returns now "error: error msg" if there was a error during sending or receiving the requestUpdated: $send server request, returns now "error: error msg" if there was a error during sending or receiving the request Link to post Share on other sites
Bliss 194 Posted February 16, 2015 Author Report Share Posted February 16, 2015 Perfect. Thought so. Thanks for confirming. A tip of my hat to you for making this plugin. Opens up so many doors. And the support.... outstanding! Thanks Pete, we aim to please! Link to post Share on other sites
awpramono 1 Posted February 16, 2015 Report Share Posted February 16, 2015 (edited) How to do load cookies?? I just tried but didn't work .... Here what I doing : use CBrowser to login youtube and save CBrowser cookies... then load the cookies saved, and navigate to CBrowser but i got the youtube is not logged in... Please if you've an example ... Edited February 16, 2015 by awpramono Link to post Share on other sites
diskwizz 24 Posted February 16, 2015 Report Share Posted February 16, 2015 How to do load cookies?? I just tried but didn't work .... Here what I doing : use CBrowser to login youtube and save CBrowser cookies... then load the cookies saved, and navigate to CBrowser but i got the youtube is not logged in... Please if you've an example ... Yeah currently im still thinking how i should handle the cookies internally, for now you first have to load the page then load the cookies and refresh the page. I'm working on solving this issue though, but this is the current work around for it. Link to post Share on other sites
Recommended Posts