Click here to Skip to main content
16,019,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: "Virtual" Command Prompt Pin
hxhl9513-Mar-10 10:52
hxhl9513-Mar-10 10:52 
AnswerRe: "Virtual" Command Prompt Pin
Hristo-Bojilov13-Mar-10 11:39
Hristo-Bojilov13-Mar-10 11:39 
GeneralRe: "Virtual" Command Prompt [modified] Pin
hxhl9513-Mar-10 12:31
hxhl9513-Mar-10 12:31 
GeneralRe: "Virtual" Command Prompt Pin
hxhl9513-Mar-10 13:41
hxhl9513-Mar-10 13:41 
AnswerRe: "Virtual" Command Prompt Pin
Stephen Hewitt13-Mar-10 18:23
Stephen Hewitt13-Mar-10 18:23 
QuestionModeless dialog closing when 'Enter' key is pressed? Pin
Spawn@Melmac13-Mar-10 8:05
Spawn@Melmac13-Mar-10 8:05 
AnswerRe: Modeless dialog closing when 'Enter' key is pressed? Pin
Spawn@Melmac13-Mar-10 8:17
Spawn@Melmac13-Mar-10 8:17 
QuestionSOCKET_ERROR when calling send method from seperate class Pin
Omar El Fata13-Mar-10 6:49
Omar El Fata13-Mar-10 6:49 
Hi,

I have two classes, MainDlg.cpp, and Game.cpp . My MainDlg.cpp file is responsible for TCP communication, and it works fine on its own. I initially start MainDlg.cpp and then I start the Game.cpp class from there. Iam trying to call the DoSend() (on MainDlg.cpp) method from the Game.cpp file and it just results in a SOCKET_ERROR !

Just for experimentaion I've tried to call a method on MainDlg.cpp from Game.cpp to display a simple MessageBox and it works, so the problem is not with the class object I created.

This is how I created/call the Game.cpp object on MainDlg.cpp

Game* game = new Game;
game->Create(Game::IDD);


When the Game.cpp dialog comes up, this is how I execute the method on MainDlg.cpp:
CMainDlg* Main = new CMainDlg;
Main->GetResults();



In MainDlg.cpp :

GetResults method: <-- Works fine when run locally
void CMainDlg::GetResults()
{
	Message_PDU Message;
	Message.iMessageNumber = 80;
	DoSend(Message);
}


DoSend Method: <-- Works fine when run locally
void CMainDlg::DoSend(Message_PDU Message) // Send Message to Server
{	
	int iBytesSent;
	iBytesSent = send(m_iSocket, (char *) &Message, sizeof(Message_PDU), 0);
	if(SOCKET_ERROR == iBytesSent)
	{
		MessageBox("Failed to send","Client");
	}
}



Any help will be really appreciated!
QuestionRe: SOCKET_ERROR when calling send method from seperate class Pin
CPallini13-Mar-10 6:56
mveCPallini13-Mar-10 6:56 
AnswerRe: SOCKET_ERROR when calling send method from seperate class Pin
Omar El Fata13-Mar-10 7:08
Omar El Fata13-Mar-10 7:08 
GeneralRe: SOCKET_ERROR when calling send method from seperate class Pin
Omar El Fata13-Mar-10 7:45
Omar El Fata13-Mar-10 7:45 
AnswerRe: SOCKET_ERROR when calling send method from seperate class Pin
krmed13-Mar-10 10:26
krmed13-Mar-10 10:26 
GeneralRe: SOCKET_ERROR when calling send method from seperate class Pin
Omar El Fata13-Mar-10 11:01
Omar El Fata13-Mar-10 11:01 
QuestionWindow class, caption Pin
trioum13-Mar-10 4:26
trioum13-Mar-10 4:26 
AnswerRe: Window class, caption Pin
Eugen Podsypalnikov13-Mar-10 4:34
Eugen Podsypalnikov13-Mar-10 4:34 
GeneralRe: Window class, caption Pin
trioum13-Mar-10 4:43
trioum13-Mar-10 4:43 
GeneralRe: Window class, caption Pin
Eugen Podsypalnikov13-Mar-10 12:58
Eugen Podsypalnikov13-Mar-10 12:58 
QuestionRe: Window class, caption Pin
David Crow13-Mar-10 5:20
David Crow13-Mar-10 5:20 
AnswerRe: Window class, caption Pin
ThatsAlok14-Mar-10 19:21
ThatsAlok14-Mar-10 19:21 
QuestionHow can use VB dll in VC++ code? Pin
Le@rner13-Mar-10 1:45
Le@rner13-Mar-10 1:45 
AnswerRe: How can use VB dll in VC++ code? Pin
LunaticFringe13-Mar-10 2:33
LunaticFringe13-Mar-10 2:33 
AnswerRe: How can use VB dll in VC++ code? Pin
ThatsAlok14-Mar-10 19:24
ThatsAlok14-Mar-10 19:24 
AnswerRe: How can use VB dll in VC++ code? Pin
Shivanand Gupta14-Mar-10 20:30
Shivanand Gupta14-Mar-10 20:30 
QuestionCalling vb dll functions in my vc code Pin
learningvisualc12-Mar-10 21:23
learningvisualc12-Mar-10 21:23 
AnswerRe: Calling vb dll functions in my vc code Pin
Shivanand Gupta13-Mar-10 0:36
Shivanand Gupta13-Mar-10 0:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.