|
If you don't want to wait for the new process to finish just use WinExec or ShellExecute. If you need to wait use CreateProcess.
Like it or not, I'm right.
|
|
|
|
|
I am sunk in misery now. I have a program running as a service. It opens a TCP port [Winsock only/no CSocket stuff] and listens on it. Once a TCP connection is made it does some stuff which included inserting into an MS Access mdb. I use CDatabase for it. Now I have an unusual problem. After 2-3 days of running, the service suddenly starts hogging system resources. My machine crawls to a slow slow pace and I can't even move the mouse properly. If I stop and restart the service, with some difficulty given the system condition, it get's okay again. I am confused as to what's going on. What's funny is that for the last 2 days I haven't even connected to the TCP port. It was simply running blindly. The moment a client connects I use AfxBeginThread to start a thread that processes the TCP connection. Now what I feel is that the accept call fails and thus I am actually starting a thread and passing to it a bad SOCKET. I am not checking whether the SOCKET is okay. But what saddens me no end is the fact that this shouldn't be happening. Wht should accept fail? I thought accept would block and block and block and block and block and block and block till a connection is made
Regards
Sad-Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I had a simmilar problem, but it related to the Access database and i wasn't using a socket connection. It turned out that the ODBC driver you need to set up on the ODBC Cad 32 was out of date and the program just sat there chewing up processing time and ram... I don't know if this is your problem, but you could try to look at Access connection for the fault. Good Luck
Dor
|
|
|
|
|
Thanks Dor.
What puzzles me is that when I am inserting, no probs at all.
But I leave it idle for a couple of days and this happens
Nish
p.s. I have added the check to see that the socket accept(...) returns is a valid socket. Hopefully, that should solve it
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I want to study proxy severs.
Could anyone tell me where could find the Proxy Source code ??
Thx
|
|
|
|
|
There are different types of proxies :-
HTTP proxy
SMTP proxies
POP3 proxies
SOCKS proxies
Telnet proxies
Each cater to the needs of the underlying protocol
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
I see , and I need the knowledge of Web http proxy.
Do you have any ?
|
|
|
|
|
Hi,
I'd once read the source code of SQUID.. you can try that
out.. its a little tricky.. coz of Call back functions.
But give it a try!
Regards
Sameer
chaolong wrote:
want to study proxy severs
|
|
|
|
|
But I didn't konw what is SQUID,Could you tell me?
|
|
|
|
|
chaolong wrote:
But I didn't konw what is SQUID,Could you tell me?
Hi,
Squid is a Proxy server for Linux.. and it is Open
Source, I had once modified the source code of
squid.. Its a 40,000 lines of Code so you better
read its Squid Programming Guide, before you
read the source code.
BTW what exactly do you want to know about proxy servers.
Sameer
|
|
|
|
|
ok... a functoin is declaring somthng like
voide SetName(char Name)
{
}
correct?
then if you want to use that in your program you could do somthing like
int main()
{
SetName("Judy")
return 0;
}
now... even though this wont do anything... "because there isnt anything int eh SetName function... this would work right?
i declared my void SetName(char Name); in a header class named Student so:
void Student::SetName(char Name);
{
}
int main()
{
char SName[32];
cin >> SName;
SetName(SName);
return 0;
}
wouldnt this work... what am i forgetting... i keep getting a undeclared identities thing.
Thanks all!
~SilverShalkin
|
|
|
|
|
Use the correct decl.
void Student::SetName(char* Name);
{
}
|
|
|
|
|
Rama Krishna wrote:
void Student::SetName(char* Name);
{
}
You would actually need to remove the semicolon:
void Student::SetName(char* Name)
{
}
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
You are passing a char* to a char.
Change the char to char* in your function's argument list
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
SilverShalkin wrote:
voide SetName(char Name)
{
}
correct?
A global function, yes.
SilverShalkin wrote:
int main()
{
SetName("Judy")
return 0;
}
So long as it was visible to main, i.e. declared before it or forward declared.
SilverShalkin wrote:
wouldnt this work... what am i forgetting... i keep getting a undeclared identities thing.
You can only call this function on a student, there is no global function of this name. If you made the function static, you could call it on Student itself, otherwise you need to create a student and call the method.
Student s;
s.SetName("a") // You allowed a char, which is one character
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Christian Graus wrote:
s.SetName("a") // You allowed a char, which is one character
"a" ???
Shouldn't this be 'a'???
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Yeah, but at least I spotted why he couldn't access the function....
Seriously, you're right, of course. *blush*
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Christian Graus wrote:
Yeah, but at least I spotted why he couldn't access the function....
No points for that The guy already knew that
|
|
|
|
|
Then why did he ask:
wouldnt this work... what am i forgetting... i keep getting a undeclared identities thing.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
The funny thing is that it might have worked for the guy if he casted it and he'd have used it without realizing it was a typo error
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Blast. My bad!!!
He'd have been casting the pointer address to char
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Christian Graus wrote:
Student s;
s.SetName("a") // You allowed a char, which is one character
I was thinking that.. the only problem is that the student...
Student s
i will always keep adding students.. could i make s an array?
that always changes? like:
Student s[nextname];
?
Thanks All
~SilverShalkin
|
|
|
|
|
No, you cannot do that - you can make an array of students ( or better yet, a std::vector ). That would be the point - each student knows what it's name is.
To make s an array you would put
Student [12] s;
( from memory )
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|
|
Christian Graus wrote:
Student [12] s;
why is the [12] behind s? And so i wouldnt beable to make the [12] into somthing that increases everytime you call it?
oh,... this project is a learning project... its not ment to go the easy path or anything, its ment for me to understand the class and using header. there is a couple other ways i probably could do this "me" you know, the guy that know the least on this forum...
thanks again! c-ya
~SilverShalkin
|
|
|
|
|
SilverShalkin wrote:
why is the [12] behind s? And so i wouldnt beable to make the [12] into somthing that increases everytime you call it?
Read my first STL article, on vector. That's what you need to have a dynamic array.
SilverShalkin wrote:
oh,... this project is a learning project... its not ment to go the easy path or anything, its ment for me to understand the class and using header. there is a couple other ways i probably could do this "me" you know, the guy that know the least on this forum...
I applaud you for taking this on, I'm sure you'll learn a lot from it.
Just keep the questions coming....
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
And you don't spend much time with the opposite sex working day and night, unless the pizza delivery person happens to be young, cute, single and female. I can assure you, I've consumed more than a programmer's allotment of pizza, and these conditions have never aligned. - Christopher Duncan - 18/04/2002
|
|
|
|