|
What is the difference between Stack Commit Size Vs Stack Reserve Size Vs Stack param inside the create thread func? Thanks.
|
|
|
|
|
Hi, i need a way to communicate between my app which is written in C++ and Java. The problem is, the application that runs the java code is not mine and it just runs the java code in a safe environment. This poses some security restrictions such as, i can't open any sockets, and seeings that was the obvious way to me to make them communicate, i don't know what to try next. Are there any facilities in Java to make communication with another windows application easier?
Thanks in advance for any responses.
Kuniva
--------------------------------------------
|
|
|
|
|
What do you exactely want to do upon the java application?
Wouldn't signal sends work ?
TOXCCT >>> GEII power
|
|
|
|
|
What exactly are signal sends? Never heard of them..
Kuniva
--------------------------------------------
|
|
|
|
|
I'm going to pretend to be an expert on this because I just hooked up a browser-based Java application to a complex C++ library using JNI.
To get meaningful communication between the Java applet and your C++ application, you are probably going to need to remove the security restrictions on the applet so it runs outside the browser's sandbox. You can do this by signing the applet with a cryptographic signature, or by running the Java code as an application instead of an applet. Once you do this, the Java app and your C++ app can communicate by sockets, or writing files to the local filesystem, or you could use JNI (or COM if the applet is written for the Microsoft VM) and package your C++ app as a DLL that the Java applet can call.
If you can't or don't want to change the security restrictions on the Java applet, pretty much the only way to get it to communicate is to have both it and your C++ app talk to the same server on the applet's host (I suppose you could also send Windows messages to the applet's window, but that's a really limited form of communication). Applets are allowed to open a socket, but only back to a server on the host from which they were downloaded. Hosting the applet on your local machine might work for you as well.
|
|
|
|
|
Well the problem is that the java code is not running in a browser and its not an applet, its just.. scripts running through JNI already by another application, so i can write the scripts, but not change the application. So i want to communicate with the scripts.
Kuniva
--------------------------------------------
|
|
|
|
|
If code you don't control is putting the Java code in a restricted sandbox, there isn't a lot you can do (that's what the sandbox features is for, after all).
Do you know the details of the sandbox restrictions? Do you get a SecurityException when you try to connect to a local socket from the Java?
|
|
|
|
|
Yes thats exactly how it is. But when i try to make a socket, i just get an error, not an exception i think, the code is basically like this:
try
{
ds = new Socket(InetAddress.getByName("localhost"),port);
}
catch(UnknownHostException uhe)
{}
catch(IOException ie)
{}
catch(Error e)
{
CodexConsole.Print(0,1,"Error");
}
And i always get the error. I looked at the definition of JNI_CreateJavaVM and there's like three parameters u pass right? Well i might be able to "crack" them out of the java container application if i know what to change, but i'm not sure.. Would that work? if i could somehow lift the restrictions?
Thanks for your help.
Kuniva
--------------------------------------------
|
|
|
|
|
The restrictions aren't put in when the VM is started, but sometime later with a call to System.setSecurityManager
|
|
|
|
|
In my code, I have a menu to restart a service. Previously, I was calling ControlService(hService, SERVICE_CONTROL_STOP, &ServiceStatus) to stop it, and then StartService(hService, 0, 0) to start it. However, ocaasionally, this does not work. Putting a sleep(100) between these two events seems to fix it. However, I cannot guarantee this solution on all machines. Does anyone know how microsoft implements their restart button in the Services Control Panel?
|
|
|
|
|
tried using EnumServicesStatus() ?
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
Thanks. Would I have to call this in a while loop and keep trying to start this when it's not yet started? How long would I wait? I'm trying to see if anyone knows how Microsoft does it and what their timeout value is.
|
|
|
|
|
how do i save html + images in that html?
here i found a sample which does save html only, how about saving
images?????
http://home.inreach.com/mdunn/code/URLDownload/URLDownload.html
Thanks
|
|
|
|
|
|
man i was not drunk and i wanna save html page + images using my vc
application
So do i have right to ask it here now?
DOES Web Browser control let save html+images ? or it does let save only HTML?
|
|
|
|
|
im sure u are looking for this
http://www.codeproject.com/shell/iesaveas.asp
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|
|
well this is not exactly what i need i already checked this article
it does save file as .mht but i need FULL WEB PAGE. I changed SAVE TYPE in code and did try to save whole page but it doesnt save images only html code.
thanks for responce
|
|
|
|
|
I noticed in the project settings that you can set the stack size. I think it was system under the linker tab inside the project settings. What does this mean. Is it the initial stack size for main or is it the default setting for any new threads created? What should the values be? I also saw something like commit stack? What's this? Thanks.
|
|
|
|
|
Anonymous wrote:
What does this mean.
What does what mean? Are you saying that the option to set the stack size should be elsewhere?
Anonymous wrote:
What should the values be?
1MB is the default, and is satisfactory is most instances.
Anonymous wrote:
I also saw something like commit stack? What's this?
Per the docs:
Provides a space for you to specify the amount, in bytes, of physical memory to allocate from the reserve memory.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
hi,
I am in a gr8 trouble. I am making a client server application using ASync sockets with oracle as backend. Every thing is working fine but the problem is with closing the connection after it's use completes. i.e. when for the first time client connects to the server he is able to log in and send the data but after that is any client tries to log in then server gives the Assssertion failure error in line 177 winsock on ignoring the error the client works fine but if this happens server cannot log in the clients automatically. if there is a way to ignore this failuer or what i feel abt error is that once the socket is closed and after that if some body tries to give it gives a invaled socket error this was found out when i tried to debug the error. tell me what i can do to solve the problem. can this be due to the single m_sConnection socket i have used that when closed closes everything but there is another socket cvariacle ie m_sListenSocket that i have iused to accept connections ie m_sListensocket.accept(m_sconnectionsocket).
help me to understnd it
|
|
|
|
|
Has anyone come across this before. Let say you create two threads with the create thread function. You specify 1 gig (I know you would never do this) for the stack parameter for each thread. Now you try to create a third thread. The stack value is let's say 10 MB. The function will not work. It won't create the third thread. This problem seems to happen on different combinations. Let's say you make 200 threads with a stack value of 100 MB each, then you add one more thread; this thread will not create.
|
|
|
|
|
Anonymous wrote:
Has anyone come across this before.
No, and I can't imagine anyone would under most circumstances.
You are encroaching on the 2GB limit. If you were using an OS that supported it, the /3GB switch would possibly get you access to a larger stack.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
This is a basic Windows constraint, in that they 'reserve' virtual addresses for the requested stack space for each thread, and they constrain the total amount of reserved space so that it fits within the 2 Gb process memory limit.
Taking a guess, you are implementing a multithreaded algorithm that is heavily recursive, with lots of local data at each recursive call (therefore the need for the huge stack). This is something I've seen in the artificial intelligence courses I took (a long time ago, I'll admit ).
The constraint here is that specifying a stack size S constrains the number of threads T, such that (S * T) < 2 Gb. The key to getting around this constaint is to move the data from the stack to the heap.
Here's an example. Suppose our original recursive function looks like this:
struct S {
char BigBlobOfData[100000];
};
void F()
{
S s;
F();
} Every recursive call deeper you go uses an 'S'-sized chunk of stack. Therefore, if you need to recurse N levels, you need a stack depth of at least (N * S), and this gets applied to your constraint for the number of threads. If you used the heap instead:
void F()
{
S *s = new S;
F();
} the stack required for each recursive call is only the size of the pointer. Therefore, for the same depth of recursion, you require far less stack space. This lets you increase the number of threads.
The big caveat to all this is: you've only got so much memory available. Whether it's allocated on the stack or the heap, this approach doesn't address the fact that your algorithm is memory-intensive. It's just given you a little more flexibility.
Software Zen: delete this;
|
|
|
|
|
Hi all,
I'm writing a WinNT service. My service prog will have to receive a user defined(or registered) message from another service based platform.but the based platform service is designed to send message to application(i think it has bind the application's desktop with SetThreadDesktop function). my service can not receive any message from it.
can anybody help me?what should i do to receive the message?
|
|
|
|
|
did you set SERVICE_INTERACTIVE_PROCESS
for interacibg with desktop ...
greatest thing is to do wot others think you cant suhredayan@omniquad.com
messenger :suhredayan@hotmail.com
|
|
|
|