Definition at line 27 of file VideolympicsClient.h. References Impala::Util::StringParser::GetString(), ILOG_DEBUG, ILOG_ERROR, mBuffer, mVidolPort, mVidolServer, mVidolTeamNo, CommunicatingSocket::recv(), RET_CHEATER, RET_INVALID, RET_NOCONNECTION, RET_NOREPLY, RET_OK, RET_TOOLATE, RET_TOOSOON, RET_UNKNOWNREPLY, and CommunicatingSocket::send(). Referenced by Impala::Application::WindowTrecSearch::BookmarkEvent(), and Impala::Application::MediaTable::TableDataViewController::SetMarkById(). 00028 { 00029 std::ostringstream o; 00030 o << "GET /team=" << mVidolTeamNo << "/" << shotname << std::endl << std::endl; 00031 TCPSocket *s = 0; 00032 try 00033 { 00034 s = new TCPSocket(mVidolServer, mVidolPort); 00035 } 00036 catch (SocketException e) 00037 { 00038 ILOG_ERROR("SendShot " << shotname << " FAILED: could not connect to server."); 00039 if (s) delete s; 00040 return RET_NOCONNECTION; 00041 } 00042 if (s == 0) 00043 { 00044 ILOG_ERROR("SendShot " << shotname << " FAILED: could not initialize server object."); 00045 return RET_NOCONNECTION; 00046 } 00047 00048 std::string call = o.str(); 00049 s->send(call.c_str(), (int)call.length()); 00050 int length = s->recv(mBuffer, 2048); 00051 if (length <= 0) 00052 { 00053 ILOG_ERROR("SendShot " << shotname << " FAILED: No reply from server."); 00054 delete s; 00055 return RET_NOREPLY; 00056 } 00057 // ILOG_DEBUG("Read " << length<< " bytes from server."); 00058 mBuffer[length] = 0; 00059 Util::StringParser p = Util::StringParser(mBuffer); 00060 00061 std::string r = p.GetString('\n'); 00062 int replycode = RET_UNKNOWNREPLY; 00063 00064 if (r == "OK") replycode = RET_OK; 00065 else if (r == "ERROR INVALID") replycode = RET_INVALID; 00066 else if (r == "ERROR TOOSOON") replycode = RET_TOOSOON; 00067 else if (r == "ERROR TOOLATE") replycode = RET_TOOLATE; 00068 else if (r == "ERROR CHEATING DETECTED") replycode = RET_CHEATER; 00069 00070 if (replycode != 0) 00071 { 00072 ILOG_ERROR("SendShot " << shotname << ": FAILED with error code " << replycode << ": " << r); 00073 } else { 00074 ILOG_DEBUG("SendShot " << shotname << ": OK"); 00075 } 00076 00077 delete s; 00078 return replycode; 00079 }
Here is the call graph for this function:
|