|
i am eliminating the request from client because the settings changed on the server should be updated immediately to all the clients.
can you please guide me how to write a listening thread, it would be very helpful and how to send the update command to all the clients.
in my application clients are independently running they they take only the settings from server and nothing else. we thought of doing this because server downloads the new settings from another host and then will distribute the settings locally on LAN.
Naveen
|
|
|
|
|
in client modual,I start a thread by createthread(),
in the thread fuction,i use blocked socket api,accept(). and make the thread always runing by while(1).
like below:
while(1)
{
....
accept(); //thread will be blocked here ,i think it's efficient,no more
// cpu time
....
}
in the admin modual, when you want to send changes,using the connect()and send().
do I make myself clear for you?
if not ,I sorry. because english is not my mother language.
if any question more ,we can discuss more.
|
|
|
|
|
thank you for your precious time
it means all my user modules should be connected to admin module and wait in an infinite loop.
what method shall i use to connect to the admin module.
i think my list of questions is growing. since i have recently started working on .net, i dont know much about .net
Naveen
|
|
|
|
|
.net i am not familiar. my project is vc++6.0. so i use blocked socket api.on my admin module,i start a thread for listening client(infinite loop),when client connected successfully,admin module start another thread to dealling with the data transfer.
hope my method can help you.
modified on Wednesday, February 25, 2009 7:51 PM
|
|
|
|
|
thank you
i will try to work it out as u have said. will get back if any problems
Naveen
|
|
|
|
|
I am new to C++/CLI.
Tried to reference a dll from VC++ project with Common Language Runtime Support (/clr).
I am getting the below error message when running application.
"An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module."
What could be the problem?
|
|
|
|
|
KASR1 wrote: I am new to C++/CLI.
What else are you new to, programming?
KASR1 wrote: "An unhandled exception of type 'System.TypeInitializationException' occurred in Unknown Module."
What could be the problem?
Yes indeed, what could be the problem, try clicking on this link[^]
|
|
|
|
|
Are you making fun!
I have tried searching Google and most of them were not specific to my problem.
So we posted it here.
For getting quick solution only we are posting here. Not to make fun!
Kindly give us the solution if you know or dont post a reply like this!
|
|
|
|
|
KASR1 wrote: Kindly give us the solution if you know
I did. If you are not capable of using the link I provided to solve your problem then you need to listen to this song[^]
KASR1 wrote: or dont post a reply like this!
I will post anything I want asswipe, go f*** yourself.
Oh, and have a nice day.
|
|
|
|
|
Who gave MVP to You! Instead they should give you FVP!!
By seeing your reply they regret themselves.
|
|
|
|
|
I am working on asp.net using c#
I am working on folderbrowserdialog I got an exception
<big>>"Current thread must be set to single thread apartment (STA) mode before OLE calls can be made. Ensure that your Main function has STAThreadAttribute marked on it. This exception is only raised if a debugger is attached to the process."</big>
|
|
|
|
|
This is the "Managed C++/CLI" forum! Please post this question in the ASP.NET or C# forum.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Hello,
I'm totally new on Managed C++ and I'm creating an VS2005 C++ application on which I need to keep information for logging purposes.
The data I need to store would have been saved in the old days in a structure like this:
struct tDataEntry
{
unsigned char data[8];
long id;
unsigned int length;
unsigned int flags;
unsigned long time;
};
Being a newbie on this I immediately started getting compiler errors like "cannot define 'xxx' as a member of managed 'XXX': mixed types are not supported", so I read a little bit about Managed Code, Mixed types, the GC, etc and I searched the web for an example that could help me out but couldn't find it.
I found some articles that were close to my problem where they suggested using templates to embed a native class in a ref class but when I added the extra complexity of the arrays it just didn't work.
Anyway, I need to be able to declare a fixed size tDataEntry array in my Form class so I can fill the elements, format the information, show it, etc.
Any help on this will be appreciated!
Thanks,
Chalo
|
|
|
|
|
|
Mark Salsbery wrote: It may help to read a little bit more
NO WAY! We write code! We don't need no stinkin readin!
|
|
|
|
|
ref class A
{
...
};
int main()
{
A objA;
return 0;
}
I thought we were not supposed to be able to use ref classes that way...only through tracking handles and tracking references. The above code compiles and runs. Could someone please explain it to me?
|
|
|
|
|
TripShock wrote: Could someone please explain it to me?
They implemented stack semantics[^] in C++/CLI
|
|
|
|
|
Why is it that I can't do this:
String yo;
|
|
|
|
|
From the docs[^]:
The following reference types are not available for use with stack semantics:
*delegate
*array (Visual C++)
*String
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Welcome to CodeProject
TripShock wrote: Why is it that I can't do this:
Because you need to do this:
String^ yo;
That said, if you had spent like 10 minutes reading any of the tons of beginner material here on this site and all over the internet related to the CLI subject, you would already know that. 10 minutes rather than the 3 hours you have waited for an answer from an internet forum.
10 minutes or 3 hours, you decide.
|
|
|
|
|
hi guys,
i am creating a VC++ program that connect to mysql database on remote server.i have tried few steps but it didnt work.i need advice on which database i should use and it must be in a remore location.
i create a mysql database on speedhosting.co.cc but its a database for php. Is it possible for a C++ program connect to it and get data from there ??
|
|
|
|
|
Thilek wrote: i am creating a VC++ program
Why have you moved this topic to the Managed C++/CLI forum? Are you doing CLI development?
Thilek wrote: i have tried few steps but it didnt work
We are not mystical beings and therefore have no idea what you have tried unless you provide that information.
|
|
|
|
|
i use .net for this program..
below is my coding :-
#pragma once
#include <mysql.h>
namespace trialcpp {
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace MySql::Data::MySqlClient;
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
}
protected:
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ cmdLogin;
private: System::Windows::Forms::Button^ cmdExit;
protected:
private:
System::ComponentModel::Container ^components;
#pragma region Windows Form Designer generated code
void InitializeComponent(void)
{
this->cmdLogin = (gcnew System::Windows::Forms::Button());
this->cmdExit = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
this->cmdLogin->Location = System::Drawing::Point(52, 190);
this->cmdLogin->Name = L"cmdLogin";
this->cmdLogin->Size = System::Drawing::Size(75, 23);
this->cmdLogin->TabIndex = 0;
this->cmdLogin->Text = L"Login";
this->cmdLogin->UseVisualStyleBackColor = true;
this->cmdLogin->Click += gcnew System::EventHandler(this, &Form1::cmdLogin_Click);
this->cmdExit->Location = System::Drawing::Point(175, 190);
this->cmdExit->Name = L"cmdExit";
this->cmdExit->Size = System::Drawing::Size(75, 23);
this->cmdExit->TabIndex = 1;
this->cmdExit->Text = L"Exit";
this->cmdExit->UseVisualStyleBackColor = true;
this->cmdExit->Click += gcnew System::EventHandler(this, &Form1::Exit_Click);
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(326, 266);
this->Controls->Add(this->cmdExit);
this->Controls->Add(this->cmdLogin);
this->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
}
#pragma endregion
private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}
private: System::Void Exit_Click(System::Object^ sender, System::EventArgs^ e) {
this->Close();
}
private: System::Void cmdLogin_Click(System::Object^ sender, System::EventArgs^ e) {
MySqlDataAdapter^ mySqlDataAdapter=gcnew MySqlDataAdapter();
MySqlConnection ^conDatabase = gcnew MySqlConnection("Server=sql304.speedhosting.co.cc;Uid='speed_2972829';Pwd='kettavan'; Protocol=tcp; Pooling=false");
conDatabase->Open();
System::Windows::Forms::MessageBox::Show("Connection Successful");
conDatabase->Close();
}
};
|
|
|
|
|
led mike wrote: We are not mystical beings
speak for yourself...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I knew there was something different about you!
|
|
|
|