本文整理汇总了C++中PSIn::GetBf方法的典型用法代码示例。如果您正苦于以下问题:C++ PSIn::GetBf方法的具体用法?C++ PSIn::GetBf怎么用?C++ PSIn::GetBf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSIn
的用法示例。
在下文中一共展示了PSIn::GetBf方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PutSIn
void TFRnd::PutSIn(const PSIn& SIn, TCs& Cs){
int BfL=SIn->Len();
char* Bf=new char[BfL];
SIn->GetBf(Bf, BfL);
Cs=TCs::GetCsFromBf(Bf, BfL);
PutBf(Bf, BfL);
delete[] Bf;
}
示例2: Send
void TSockSys::Send(const uint64& SockId, const PSIn& SIn) {
// make sure it's a valid socket
IAssert(IsSock(SockId));
uv_tcp_t* SockHnd = SockIdToHndH.GetDat(SockId);
// create write request
uv_write_req_t* WriteHnd = (uv_write_req_t*)malloc(sizeof(uv_write_req_t));
// copy the data in the buffer
WriteHnd->Buffer.len = SIn->Len(); //TODO: handle cases when SIn doesn't have known Len()
WriteHnd->Buffer.base = (char*)malloc(WriteHnd->Buffer.len);
SIn->GetBf(WriteHnd->Buffer.base, WriteHnd->Buffer.len);
// execute the request
int ResCd = uv_write((uv_write_t*)WriteHnd, (uv_stream_t*)SockHnd, &WriteHnd->Buffer, 1, OnWrite);
// check for errors
if (ResCd != 0) {
// cleanup first
free(WriteHnd->Buffer.base);
free(WriteHnd);
// and throw exception
throw TExcept::New("SockSys.Send: Error sending data: " + SockSys.GetLastErr());
}
}