943,633 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3354
  • C++ RSS
Aug 18th, 2008
0

using send() + recv()

Expand Post »
im just wondering how you use send() and recv()

like:

cpp Syntax (Toggle Plain Text)
  1. bool blah()
  2. {
  3. if(recv(send("10.1.1.1", "HI"), szBuffer, sizeof(szBuffer))
  4. {
  5. MessageBox(NULL, "WORKED", "??", MB_OK);
  6. return true;
  7. }
  8. else
  9. {
  10. MessageBox(NULL, "FAIL", "??", MB_OK);
  11. return false;
  12. }
  13. }

i know that wouldnt compile but you get the point?
Similar Threads
Reputation Points: -14
Solved Threads: 1
Junior Poster in Training
FTProtocol is offline Offline
99 posts
since May 2008
Aug 18th, 2008
0

Re: using send() + recv()

By writing a function called sendAndReceive, which returns a boolean.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 18th, 2008
-2

Re: using send() + recv()

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?

cpp Syntax (Toggle Plain Text)
  1. bool TestConnection(char *IP)
  2. {
  3. connection conn = connect_to_server(IP, 6500);
  4.  
  5. if(rrecv(conn, szBuffer, sizeof(szBuffer)))
  6. {
  7. endconnection(conn);
  8. return true;
  9. }
  10. else
  11. {
  12. endconnection(conn);
  13. return false;
  14. }
  15. }
Last edited by FTProtocol; Aug 18th, 2008 at 4:05 am.
Reputation Points: -14
Solved Threads: 1
Junior Poster in Training
FTProtocol is offline Offline
99 posts
since May 2008
Aug 18th, 2008
0

Re: using send() + recv()

> 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.
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Aug 18th, 2008
-2

Re: using send() + recv()

again i dont need spammers and i worked out my problem.
Reputation Points: -14
Solved Threads: 1
Junior Poster in Training
FTProtocol is offline Offline
99 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: PLzzzzzzzzz HELpppppppppppppppp
Next Thread in C++ Forum Timeline: Ping type function





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC