Service::Service(istring& localIP) : m_connectedToMaster(false) { currentService = this; m_net = new Networking::NetworkingSystem(true); m_net->Initialize(); Address mCastAddr(226, 0, 0, 1, 8000); TODO("Don't hard-code this"); Address localAddr(inet_addr(localIP.c_str()), 8000); m_net->Multicast(localAddr, mCastAddr); }
bool FSServerConfigData::ReadConfigFile(const istring &fileDir) { std::ifstream file(fileDir.c_str(), std::ifstream::in); if(file.is_open() == false) { std::cout << "Unable to open \"" << fileDir << ".\\" << std::endl; return false; } file >> serverIP; file >> serverPort; file >> clientUDPport; file >> receiveFolder; file >> shareFolder; file >> defaultBufSize; return true; }
bool FSClientConfigData::ReadConfigFile(const istring &fileDir, FileReader& files) { std::ifstream file(fileDir.c_str(), std::ifstream::in); if(file.is_open() == false) { LOG("Unable to open \"" << fileDir << ".\\"); return false; } file >> serverIP; file >> serverPort; file >> clientUDPport; file >> receiveFolder; file >> shareFolder; file >> defaultBufSize; files.ArchieveFilesFromFolder(shareFolder); return true; }
void FSClient::ReceiveFileMsg(istring &message, s32 id) { c08* data = new c08[message.size()]; memcpy(data, message.c_str(), message.size()); Encoder e(true, (u08*)data, message.size()); u32 seq; e.Read(seq); delete[] data; if(seq == 0) { seq = UINT_MAX; //don't disconnect right away, might be waiting for dropped packets //add con ID on to message so save func can disconnect message += std::to_string(id); } Networking::Message toPush(message); toPush.SetSequence(seq); LOG("Recieved file transfer packet " << seq); messagesReceived_.push(toPush); return; }
s32 ShaderProgram::GetLocation(const istring &varName) const { s32 location = glGetUniformLocation(programId, varName.c_str()); GET_GLERR; return location; }