|
hello ppl
well need some start on socket programming i wrote the following code in Visual C++ 6.0
CSocket mysocket;
mysocket.Create();
now the problem is here the Create function returns FALSE i tried to find the last error by using the function getLastError and the error no is 109 and i cant get a description of what it means i have used the second version of Create function as well
i tried a loop on all the 65535 ports
mysocket.Create(i,SOCK_STREAM,"172.16.64.97")
but that didnt work either
please help me out i have even tried the CAsyncSocket class but that also fails to create a socket please help me out
|
|
|
|
|
Go through MFC Sample CHATSRVR code.
The chosen One
|
|
|
|
|
Hi all
Once again I am writing to all.
how I make my own Agent Character storage(.acs file) in VC++. can u tell me the format of (.acs file).
Thanks
|
|
|
|
|
see this URL:
http://msdn.microsoft.com/library/en-us/msagent/chareditor_4px0.asp
and the associated links!!!
"A robust program is resistant to errors -- it either works correctly, or it does not work at all; whereas a fault tolerant program must actually recover from errors."
|
|
|
|
|
Thanks. It is really helpful.
|
|
|
|
|
Are there any differences between pointers in C and C++?
Are they any new additions to the C++ pointers?
Thanks.
|
|
|
|
|
nope. a pointer is a pointer in any language, btw
nothing more than an int telling you where to find something in memory
please let me know if I helped you or not
|
|
|
|
|
Thanks, your help is definitely a welcome. However, I do
have a related question: What is the difference between
reference and pointer? Do pointers need references? For
example:
<br />
int main()<br />
{<br />
int i = 7;<br />
int* ip = &i;<br />
<br />
}<br />
In the above code, the pointer ip points to the address of
i, therefore, &i. Because pointers are the variable that holds
another object's memory address, in order to points to an address,
we need to reference that variable. Is my concept right?
Any input would be welcome.
|
|
|
|
|
Alex Ngai wrote:
Because pointers are the variable that holds
another object's memory address, in order to points to an address,
we need to reference that variable. Is my concept right?
More or less. Have a look at these two articles
A Beginners Guide to Pointers - Andrew Peace[^]
A Prelude to Pointers - Nitron[^]
Your on the right track
Paul Lyons, CCPL Certified Code Project Lurker
|
|
|
|
|
|
Hi,
I am updating the innerHTML of a page element to show a progress, the progress string inside the DIV element only updates when I move the mouse over the IE window. if it's idle it does not update.
Does anyone know a problem to this solution.
Thanks
Ceri
|
|
|
|
|
I have a int variable that works as a thread counter in the mutlithread app. At the begin of the thread funcation it will do 'threadcounter++' and at the end of the thread funcation it will do 'threadcounter--'.
I first program it with out any CriticalSection. It runs will on a NonHT CPU. But when it runs on a HT Xeon CPU. It fails. I don't konw whether it is cause by this counter.
But I suppose HT CPU can let two threads of one process run at the time(Parallelly) so it can run the operations on threadcounter in two thread at the same time. In nonHT,beacuse threads run concurrencly so it won't happen.
Is my suppose right?
Please help.
Thank you!
Let's roll!
|
|
|
|
|
If you have two threads accessing the same data IT MUST BE PROTECTED WITH A CRITICAL SECTION OR SOME OTHER FORM OF EXCLUSING LOCKING.
Whoa, there is my caps lock key.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Use InterlockedIncrement() and InterlockedDecrement() for the counter. And yes, you MUST protect data that's shared among threads with critical sections. That's their purpose.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Hi
My environment is as follows:
Windows NT 4.0 Service Pack 5. Application built using VC++ 6.0.
Timezone - Pacific Time . Location - California USA
My application maintains a collection class of objects - and each object has a CTime member (among other members) . A Timer in my application performs certain operations on each object of this collection class - based on the CTime member and its relation to the current system time. The CTime member is populated based on a 6 byte unsigned char array received from a third part application (using a predefined external Interface) - and its value is always in GMT.
Problem Definition:
At 2 AM on the first Sunday of April (when DST takes effect) - my application receives "020000" from the external interface. But while encapsulating this into a CTime object - the value gets changed effectively to 1AM on the same day. This causes downstream problems on the Timer processing.
I need to maintain the CTime member exactly as I get from the third patry app.
Note: The "Automatically adjust clock for daylight savings time" checkbox is selected (and needs to be so).
I did try passing 0 as the DST parameter in the CTime constructor - but still see that time gets set back by an hour. Not sure if there are any pre-requisites for this to work - such as setting of TZ environment variable (which is not on my machine) etc.
The way the encapsulation to CTime is done is as follows:
- Set individual parameters of the unsigned char array to a SYSTEMTIME Structure - and passing the latter to a CTime Constructor.
This problem exists - as U can imagine - only if the unsigned char array carries values between 2 AM and 3 AM.
Any help will be greatly appreciated.
Thanx
JD
|
|
|
|
|
I'm having some wierd problems with c code compiled in the VS 7.0 studio.
the code is fairly simple:
create some arrays.
use sscanf to get data out of a buffer.
...
The problem
if i use printf, or sscanf (again) or even loop through one of the arrays, all data is corrupted.
Can anyone explain this?
by the way I'm switching to gcc today!
|
|
|
|
|
Most likely the problem lies in your code, not the compiler. If you could post some of the offending code, some readers here might provide more help.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi there,
I need to get the user name (and if possible the type (like normal user, guest or administrator)), in a program. This is used for sending messages to a central message box on a server, everybody should be able to read only his messages. This will be checked by verifying the name of the intended receiver and the user name.
Will your help also work under winXP?
|
|
|
|
|
Can't you use GetUserName()?
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
VC++ 6 with AppWizard DocView disabled, how does one open/activate a view based on CFormView as the result of some user action? The view will display/accept data to be used with an ADO data source.
I can add the form/view to the project source, but can not open the view at the appropriate time.
Thanks,
Vince
|
|
|
|
|
I have a SDI MFC application using CFormView dialogs. The stupid frame is always the same size when I open the application. What's the best way for me to make the application maximize on the screen? When I've tried to ShowWindow( SW_MAXIMIZE ); it seems to just ignore it. Thanks a bunch!
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
So do you have a call to ShowWindow(SW_MAXIMIZE) in your app's InitInstance() method?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Ok, I can maximize the window doing this in the InitInstance() method, but this poses another problem. In my view's OnInitialUpdate() function I position some windows in my dialog (texts, buttons, etc). I use the size of the window to center these, but when I maximize the window, the windows aren't centered correctly, is there another way to maximize the frame, before I have to initialize my views, so that their client coordinates match up with what I'm actually going to use? Should I be arranging their positions in a different function instead?
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
|
Hi all,
I have searched several places including message boards and Google, without any result! Have I missed something or am I the first to ask regarding this:
How can I create, or get an already available, invert pen? Which when used for drawing (ex. lines) it inverts all pixel colors it comes in “touch” with. I am not looking for the DrawFocusRect function, but a pen or function that draws an invert line.
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|