im just wondering how you use send() and recv()

like:

bool blah()
{
	if(recv(send("10.1.1.1", "HI"), szBuffer, sizeof(szBuffer))
	{
		MessageBox(NULL, "WORKED", "??", MB_OK);
		return true;
	}	
	else
	{
		MessageBox(NULL, "FAIL", "??", MB_OK);
		return false;
	}
}

i know that wouldnt compile but you get the point?

Recommended Answers

All 4 Replies

By writing a function called sendAndReceive, which returns a boolean.

i dont need smart ass remarks.

edit: figured it myself.... although its slow "connecting" and when it cant "connect" i get an access violation. any ideas why?

bool TestConnection(char *IP)
{
	connection conn = connect_to_server(IP, 6500);

	if(rrecv(conn, szBuffer, sizeof(szBuffer)))
	{
		endconnection(conn);
		return true;
	}	
	else
	{
		endconnection(conn);
		return false;
	}
}
commented: Are you certain that was the tone of the post? +0
commented: Truly an idiot. -2

> i dont need smart ass remarks.
Fine, here's a "I don't give a rats ass" reply.

Plenty, but I'm not going to say a damn thing.

commented: The *ass* belongs to the rat, therefore rat's must contain an apostrophe. -3
commented: What a third class pedantic you are iamthwee. +9

again i dont need spammers and i worked out my problem.

commented: Fine. -2
commented: Yup. The person with the most reputation on daniweb is a spammer. -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.