using send() + recv()

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

using send() + recv()

 
0
  #1
Aug 18th, 2008
im just wondering how you use send() and recv()

like:

  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?
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: using send() + recv()

 
0
  #2
Aug 18th, 2008
By writing a function called sendAndReceive, which returns a boolean.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Re: using send() + recv()

 
-2
  #3
Aug 18th, 2008
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?

  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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: using send() + recv()

 
0
  #4
Aug 18th, 2008
> 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.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 99
Reputation: FTProtocol has a little shameless behaviour in the past 
Solved Threads: 1
FTProtocol FTProtocol is offline Offline
Junior Poster in Training

Re: using send() + recv()

 
-2
  #5
Aug 18th, 2008
again i dont need spammers and i worked out my problem.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC