本文整理汇总了C++中Read函数的典型用法代码示例。如果您正苦于以下问题:C++ Read函数的具体用法?C++ Read怎么用?C++ Read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Read函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ReadEx
void ReadEx(T *x)
{
Read(x, sizeof(*x));
}
开发者ID:lcs2,项目名称:carpg,代码行数:4,代码来源:Files.hpp
示例2: Read
size_t Read(T* t) { return Read(t, sizeof(T)); }
开发者ID:tapetums,项目名称:TTBbridge,代码行数:1,代码来源:File.hpp
示例3: Write
bool CGPIBDevice::Query(const char *sWrite, int &nLen, char *sRead, int nTimeout)
{
return Write(sWrite) && Read(sRead, nLen, nTimeout);
}
开发者ID:lidongqiang,项目名称:wvpctool,代码行数:4,代码来源:GPIBDevice.cpp
示例4: strlen
bool CMgProxySocket::DoV5Connect( const char* server , int port )
{
unsigned char buf[ 512 ];
buf[ 0 ] = 0x05;
buf[ 1 ] = 0x01; //connect
buf[ 2 ] = 0x00; //reserve
buf[ 3 ] = 0x03;
buf[ 4 ] = strlen( server );
memcpy( buf + 5, server, strlen( server ) );
int pos = 5 + buf[ 4 ];
short sport = htons( ( short ) port );
memcpy( buf + pos, &sport, 2 );
pos += 2;
if ( !Send( buf, pos ) )
{
m_nLastError += ( 0x1A << 8 );
return false;
}
int nret = Read( buf, 512 );
if ( nret <= 0 )
{
m_nLastError += ( 0x1B << 8 );
return false;
}
if ( nret < 10 )
{
m_nLastError = ( 0x0F << 8 );
return false;
}
if ( buf[ 0 ] != 0x05 || buf[ 2 ] != 0x00 )
{
m_nLastError = ( 0x10 << 8 );
return false;
}
/*
# X'00' success
# X'01' fail
# X'02' not allow
# X'03' net unreach
# X'04' host unreach
# X'05' connect refuse
# X'06' TTL timeout
# X'07' not support command
# X'08' not support address
# X'09' – X'FF' undef
*/
if ( buf[ 1 ] == 0 )
{
return true;
}
else if ( buf[ 1 ] == 0x01 )
{
m_nLastError = ( 0x11 << 8 );
return false;
}
else if ( buf[ 1 ] == 0x02 )
{
m_nLastError = ( 0x12 << 8 );
return false;
}
else if ( buf[ 1 ] == 0x03 )
{
m_nLastError = ( 0x13 << 8 );
return false;
}
else if ( buf[ 1 ] == 0x04 )
{
m_nLastError = ( 0x14 << 8 );
return false;
}
else if ( buf[ 1 ] == 0x05 )
{
m_nLastError = ( 0x15 << 8 );
return false;
}
else if ( buf[ 1 ] == 0x06 )
{
m_nLastError = ( 0x16 << 8 );
return false;
}
else if ( buf[ 1 ] == 0x07 )
{
m_nLastError = ( 0x17 << 8 );
return false;
}
else if ( buf[ 1 ] == 0x08 )
{
m_nLastError = ( 0x18 << 8 );
return false;
}
else
{
m_nLastError = ( 0x19 << 8 );
//.........这里部分代码省略.........
开发者ID:artificerpi,项目名称:multiget,代码行数:101,代码来源:mgproxysocket.cpp
示例5: Read
bool CMgProxySocket::DoV5Login()
{
unsigned char init[ 4 ] = {0x05, 0x02, 0x00, 0x02};
if ( !Send( init, 4 ) )
{
m_nLastError = ( 0x03 << 8 );
return false;
}
unsigned char buf[ 256 ];
int nret = Read( buf, 256 );
if ( nret != 2 )
{
m_nLastError = ( 0x04 << 8 );
return false;
}
if ( buf[ 0 ] != 0x05 )
{
m_nLastError = ( 0x05 << 8 );
return false;
}
if ( buf[ 1 ] == 0xFF )
{
m_nLastError = ( 0x06 << 8 );
return false;
}
if ( buf[ 1 ] != 0 && buf[ 1 ] != 1 && buf[ 1 ] != 2 )
{
m_nLastError = ( 0x07 << 8 );
return false;
}
if ( buf[ 1 ] == 0 )
{ //ok
return true;
}
else if ( buf[ 1 ] == 1 )
{ //GSSAPI
m_nLastError = ( 0x08 << 8 );
return false;
}
else
{ //u/p
int tl = 0;
buf[ 0 ] = 0x01;
tl++;
buf[ tl ] = m_ProxyUser.length();
tl++;
memcpy( buf + tl, m_ProxyUser.c_str(), m_ProxyUser.length() );
tl += m_ProxyUser.length();
buf[ tl ] = m_ProxyPass.length();
tl++;
memcpy( buf + tl, m_ProxyPass.c_str(), m_ProxyPass.length() );
tl += m_ProxyPass.length();
if ( !Send( buf, tl ) )
{
m_nLastError += ( 0x09 << 8 );
return false;
}
if ( Read( buf, 256 ) != 2 )
{
m_nLastError = ( 0x0A << 8 );
return false;
}
if ( buf[ 0 ] != 0x01 )
{
m_nLastError = ( 0x0B << 8 );
return false;
}
if ( buf[ 1 ] != 0x00 )
{
m_nLastError = ( 0x0C << 8 );
return false;
}
return true;
}
return false;
}
开发者ID:artificerpi,项目名称:multiget,代码行数:90,代码来源:mgproxysocket.cpp
示例6: main
int
main( int argc, char **argv )
{
int listenfd, connfd, sockfd;
int client[FD_SETSIZE];
int i, maxfd, maxi, nready;
socklen_t clilen;
ssize_t n;
char buff[MAXLINE];
struct sockaddr_in servaddr, cliaddr;
fd_set rset, allset;
listenfd = Socket( AF_INET, SOCK_STREAM, 0 );
bzero( &servaddr, sizeof( servaddr ) );
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = htonl( INADDR_ANY );
servaddr.sin_port = htons( SERV_PORT );
Bind( listenfd, ( struct sockaddr * )&servaddr, sizeof( servaddr ) );
Listen( listenfd, 10 );
maxfd = listenfd;
maxi = -1;
for ( i = 0; i < FD_SETSIZE; i++ ) {
client[i] = -1;
}
FD_ZERO( &allset );
FD_SET( listenfd, &allset );
for ( ; ; ) {
rset = allset;
nready = Select( maxfd+1, &rset, NULL, NULL, NULL );
if ( FD_ISSET( listenfd, &rset ) ) {
clilen = sizeof( cliaddr );
connfd = Accept( listenfd, ( struct sockaddr * )&cliaddr, &clilen );
for ( i = 0; i < FD_SETSIZE; i++ ) {
if ( client[i] < 0 ) {
client[i] = connfd;
break;
}
}
if ( i == FD_SETSIZE )
err_quit( "too many clients" );
FD_SET( connfd, &allset );
if ( connfd > maxfd )
maxfd = connfd;
if ( i > maxi )
maxi = i;
if ( --nready <= 0 )
continue;
}
for ( i = 0; i <= maxi; i++ ) {
if ( ( sockfd = client[i] ) < 0 )
continue;
if ( FD_ISSET( sockfd, &rset ) ) {
if ( ( n = Read( sockfd, buff, MAXLINE ) ) == 0 ) {
close( sockfd );
FD_CLR( sockfd, &allset );
client[i] = -1;
} else
writen( sockfd, buff, n );
if ( --nready <= 0 )
break;
}
}
}
}
开发者ID:longshadian,项目名称:chen.C,代码行数:78,代码来源:tcpservselect1.c
示例7: while
int CSocketServer::WorkerThread::Run()
{
try
{
while ( true )
{
/*
* Continually loop to service io completion packets
*/
bool closeSocket = false;
DWORD dwIoSize = 0;
Socket *pSocket = 0;
CIOBuffer *pBuffer = 0;
try
{
m_iocp.GetStatus( (PDWORD_PTR)&pSocket, &dwIoSize, (OVERLAPPED **)&pBuffer );
}
catch (const CWin32Exception &e)
{
if ( e.GetError() != ERROR_NETNAME_DELETED &&
e.GetError() != WSA_OPERATION_ABORTED )
{
throw;
}
Output( _T("IOCP error [client connection dropped] - ") +
GetLastErrorMessage( ::WSAGetLastError() ) );
closeSocket = true;
}
if ( !pSocket )
{
/*
* A completion key of 0 is posted to the iocp to request us to shut down...
*/
break;
}
/*
* Call to unqualified virtual function
*/
OnBeginProcessing();
if ( pBuffer )
{
const IO_Operation operation = static_cast<IO_Operation>( pBuffer->GetUserData() );
switch ( operation )
{
case IO_Read_Request:
Read( pSocket, pBuffer );
break;
case IO_Read_Completed :
if ( 0 != dwIoSize )
{
pBuffer->Use( dwIoSize );
//DEBUG_ONLY( Output(_T("RX: ") + ToString(pBuffer) + _T("\n") + DumpData(reinterpret_cast<const BYTE*>( pBuffer->GetWSABUF()->buf), dwIoSize, 40) ) );
/*
* Call to unqualified virtual function
*/
ReadCompleted( pSocket, pBuffer );
}
else
{
/*
* client connection dropped...
*/
Output( _T("ReadCompleted - 0 bytes - client connection dropped") );
closeSocket = true;
}
pSocket->Release();
pBuffer->Release();
break;
case IO_Write_Request :
Write( pSocket, pBuffer );
if ( dwIoSize != 0 )
{
/*
* final write, now shutdown send side of connection
*/
pSocket->Shutdown( SD_SEND );
}
//.........这里部分代码省略.........
开发者ID:XeanoRRR,项目名称:mmo-resourse,代码行数:101,代码来源:SocketServer.cpp
示例8: Read
uint In::Read16()
{
byte data[2];
Read( data, 2 );
return data[0] | uint(data[1]) << 8;
}
开发者ID:JasonGoemaat,项目名称:NestopiaDx9,代码行数:6,代码来源:NstStream.cpp
示例9: GetPos
int Buffer::Peek() {
int curPos = GetPos();
int ch = Read();
SetPos(curPos);
return ch;
}
开发者ID:MrBentCode,项目名称:CocoCPP,代码行数:6,代码来源:Scanner.cpp
示例10: HistoryFrames
FStatsThreadState::FStatsThreadState( FString const& Filename )
: HistoryFrames( MAX_int32 )
, MaxFrameSeen( -1 )
, MinFrameSeen( -1 )
, LastFullFrameMetaAndNonFrame( -1 )
, LastFullFrameProcessed( -1 )
, bWasLoaded( true )
, CurrentGameFrame( -1 )
, CurrentRenderFrame( -1 )
{
const int64 Size = IFileManager::Get().FileSize( *Filename );
if( Size < 4 )
{
UE_LOG( LogStats, Error, TEXT( "Could not open: %s" ), *Filename );
return;
}
TAutoPtr<FArchive> FileReader( IFileManager::Get().CreateFileReader( *Filename ) );
if( !FileReader )
{
UE_LOG( LogStats, Error, TEXT( "Could not open: %s" ), *Filename );
return;
}
FStatsReadStream Stream;
if( !Stream.ReadHeader( *FileReader ) )
{
UE_LOG( LogStats, Error, TEXT( "Could not open, bad magic: %s" ), *Filename );
return;
}
// Test version only works for the finalized stats files.
const bool bIsFinalized = Stream.Header.IsFinalized();
check( bIsFinalized );
TArray<FStatMessage> Messages;
if( Stream.Header.bRawStatsFile )
{
const int64 CurrentFilePos = FileReader->Tell();
// Read metadata.
TArray<FStatMessage> MetadataMessages;
Stream.ReadFNamesAndMetadataMessages( *FileReader, MetadataMessages );
ProcessMetaDataForLoad( MetadataMessages );
// Read frames offsets.
Stream.ReadFramesOffsets( *FileReader );
// Verify frames offsets.
for( int32 FrameIndex = 0; FrameIndex < Stream.FramesInfo.Num(); ++FrameIndex )
{
const int64 FrameFileOffset = Stream.FramesInfo[FrameIndex].FrameFileOffset;
FileReader->Seek( FrameFileOffset );
int64 TargetFrame;
*FileReader << TargetFrame;
}
FileReader->Seek( Stream.FramesInfo[0].FrameFileOffset );
// Read the raw stats messages.
FStatPacketArray IncomingData;
for( int32 FrameIndex = 0; FrameIndex < Stream.FramesInfo.Num(); ++FrameIndex )
{
int64 TargetFrame;
*FileReader << TargetFrame;
int32 NumPackets;
*FileReader << NumPackets;
for( int32 PacketIndex = 0; PacketIndex < NumPackets; PacketIndex++ )
{
FStatPacket* ToRead = new FStatPacket();
Stream.ReadStatPacket( *FileReader, *ToRead, bIsFinalized );
IncomingData.Packets.Add( ToRead );
}
FStatPacketArray NowData;
// This is broken, do not use.
// Exchange( NowData.Packets, IncomingData.Packets );
// ScanForAdvance( NowData );
// AddToHistoryAndEmpty( NowData );
// check( !NowData.Packets.Num() );
}
}
else
{
// Read the condensed stats messages.
while( FileReader->Tell() < Size )
{
FStatMessage Read( Stream.ReadMessage( *FileReader ) );
if( Read.NameAndInfo.GetField<EStatOperation>() == EStatOperation::SpecialMessageMarker )
{
// Simply break the loop.
// The profiler supports more advanced handling of this message.
break;
}
else if( Read.NameAndInfo.GetField<EStatOperation>() == EStatOperation::AdvanceFrameEventGameThread )
{
ProcessMetaDataForLoad( Messages );
if( CurrentGameFrame > 0 && Messages.Num() )
{
//.........这里部分代码省略.........
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:101,代码来源:StatsFile.cpp
示例11: Read
T Read()
{
T x;
Read(&x, sizeof(T));
return x;
}
开发者ID:lcs2,项目名称:carpg,代码行数:6,代码来源:Files.hpp
示例12: CacheRead
long CacheRead( CICell ih, char * buffer, long long offset,
long length, long cache )
{
long cnt, oldestEntry = 0, oldestTime, loadCache = 0;
CacheEntry *entry;
// See if the data can be cached.
if (cache && (gCacheIH == ih) && (length == gCacheBlockSize)) {
// Look for the data in the cache.
for (cnt = 0; cnt < gCacheNumEntries; cnt++) {
entry = &gCacheEntries[cnt];
if ((entry->ih == ih) && (entry->offset == offset)) {
entry->time = ++gCacheTime;
break;
}
}
// If the data was found copy it to the caller.
if (cnt != gCacheNumEntries) {
bcopy(gCacheBuffer + cnt * gCacheBlockSize, buffer, gCacheBlockSize);
#if CACHE_STATS
gCacheHits++;
#endif
return gCacheBlockSize;
}
// Could not find the data in the cache.
loadCache = 1;
}
// Read the data from the disk.
Seek(ih, offset);
Read(ih, (long)buffer, length);
#if CACHE_STATS
if (cache) gCacheMisses++;
#endif
// Put the data from the disk in the cache if needed.
if (loadCache) {
// Find a free entry.
oldestTime = gCacheTime;
for (cnt = 0; cnt < gCacheNumEntries; cnt++) {
entry = &gCacheEntries[cnt];
// Found a free entry.
if (entry->ih == 0) break;
if (entry->time < oldestTime) {
oldestTime = entry->time;
oldestEntry = cnt;
}
}
// If no free entry was found, use the oldest.
if (cnt == gCacheNumEntries) {
cnt = oldestEntry;
#if CACHE_STATS
gCacheEvicts++;
#endif
}
// Copy the data from disk to the new entry.
entry = &gCacheEntries[cnt];
entry->ih = ih;
entry->time = ++gCacheTime;
entry->offset = offset;
bcopy(buffer, gCacheBuffer + cnt * gCacheBlockSize, gCacheBlockSize);
}
return length;
}
开发者ID:b-man,项目名称:MachBoot,代码行数:71,代码来源:cache.c
示例13: RAWRead
bool CVolumeWiiCrypted::CheckIntegrity() const
{
// Get partition data size
u32 partSizeDiv4;
RAWRead(m_VolumeOffset + 0x2BC, 4, (u8*)&partSizeDiv4);
u64 partDataSize = (u64)Common::swap32(partSizeDiv4) * 4;
u32 nClusters = (u32)(partDataSize / 0x8000);
for (u32 clusterID = 0; clusterID < nClusters; ++clusterID)
{
u64 clusterOff = m_VolumeOffset + dataOffset + (u64)clusterID * 0x8000;
// Read and decrypt the cluster metadata
u8 clusterMDCrypted[0x400];
u8 clusterMD[0x400];
u8 IV[16] = { 0 };
if (!m_pReader->Read(clusterOff, 0x400, clusterMDCrypted))
{
NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read metadata", clusterID);
return false;
}
aes_crypt_cbc(m_AES_ctx, AES_DECRYPT, 0x400, IV, clusterMDCrypted, clusterMD);
// Some clusters have invalid data and metadata because they aren't
// meant to be read by the game (for example, holes between files). To
// try to avoid reporting errors because of these clusters, we check
// the 0x00 paddings in the metadata.
//
// This may cause some false negatives though: some bad clusters may be
// skipped because they are *too* bad and are not even recognized as
// valid clusters. To be improved.
bool meaningless = false;
for (u32 idx = 0x26C; idx < 0x280; ++idx)
if (clusterMD[idx] != 0)
meaningless = true;
if (meaningless)
continue;
u8 clusterData[0x7C00];
if (!Read((u64)clusterID * 0x7C00, 0x7C00, clusterData))
{
NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: could not read data", clusterID);
return false;
}
for (u32 hashID = 0; hashID < 31; ++hashID)
{
u8 hash[20];
sha1(clusterData + hashID * 0x400, 0x400, hash);
// Note that we do not use strncmp here
if (memcmp(hash, clusterMD + hashID * 20, 20))
{
NOTICE_LOG(DISCIO, "Integrity Check: fail at cluster %d: hash %d is invalid", clusterID, hashID);
return false;
}
}
}
return true;
}
开发者ID:Chiri23,项目名称:dolphin,代码行数:64,代码来源:VolumeWiiCrypted.cpp
示例14: Log
bool Archive::IsArchive(bool EnableBroken)
{
Encrypted=false;
#ifndef SFX_MODULE
if (IsDevice())
{
#ifndef SHELL_EXT
Log(FileName,St(MInvalidName),FileName);
#endif
return(false);
}
#endif
if (Read(MarkHead.Mark,SIZEOF_MARKHEAD)!=SIZEOF_MARKHEAD)
return(false);
SFXSize=0;
ARCSIGN_TYPE Type;
if ((Type=IsSignature(MarkHead.Mark,sizeof(MarkHead.Mark)))!=ARCSIGN_NONE)
{
OldFormat=(Type==ARCSIGN_OLD);
if (OldFormat)
Seek(0,SEEK_SET);
}
else
{
Array<char> Buffer(MAXSFXSIZE);
long CurPos=(long)Tell();
int ReadSize=Read(&Buffer[0],Buffer.Size()-16);
for (int I=0;I<ReadSize;I++)
if (Buffer[I]==0x52 && (Type=IsSignature((byte *)&Buffer[I],ReadSize-I))!=ARCSIGN_NONE)
{
OldFormat=(Type==ARCSIGN_OLD);
if (OldFormat && I>0 && CurPos<28 && ReadSize>31)
{
char *D=&Buffer[28-CurPos];
if (D[0]!=0x52 || D[1]!=0x53 || D[2]!=0x46 || D[3]!=0x58)
continue;
}
SFXSize=CurPos+I;
Seek(SFXSize,SEEK_SET);
if (!OldFormat)
Read(MarkHead.Mark,SIZEOF_MARKHEAD);
break;
}
if (SFXSize==0)
return false;
}
if (Type==ARCSIGN_FUTURE)
{
#if !defined(SHELL_EXT) && !defined(SFX_MODULE)
Log(FileName,St(MNewRarFormat));
#endif
return false;
}
ReadHeader();
SeekToNext();
#ifndef SFX_MODULE
if (OldFormat)
{
NewMhd.Flags=OldMhd.Flags & 0x3f;
NewMhd.HeadSize=OldMhd.HeadSize;
}
else
#endif
{
if (HeaderCRC!=NewMhd.HeadCRC)
{
#ifndef SHELL_EXT
Log(FileName,St(MLogMainHead));
#endif
Alarm();
if (!EnableBroken)
return(false);
}
}
Volume=(NewMhd.Flags & MHD_VOLUME);
Solid=(NewMhd.Flags & MHD_SOLID)!=0;
MainComment=(NewMhd.Flags & MHD_COMMENT)!=0;
Locked=(NewMhd.Flags & MHD_LOCK)!=0;
Signed=(NewMhd.PosAV!=0);
Protected=(NewMhd.Flags & MHD_PROTECT)!=0;
Encrypted=(NewMhd.Flags & MHD_PASSWORD)!=0;
if (NewMhd.EncryptVer>UNP_VER)
{
#ifdef RARDLL
Cmd->DllError=ERAR_UNKNOWN_FORMAT;
#else
ErrHandler.SetErrorCode(RARX_WARNING);
#if !defined(SILENT) && !defined(SFX_MODULE)
Log(FileName,St(MUnknownMeth),FileName);
Log(FileName,St(MVerRequired),NewMhd.EncryptVer/10,NewMhd.EncryptVer%10);
#endif
#endif
return(false);
}
#ifdef RARDLL
// If callback function is not set, we cannot get the password,
// so we skip the initial header processing for encrypted header archive.
// It leads to skipped archive comment, but the rest of archive data
//.........这里部分代码省略.........
开发者ID:089git,项目名称:calibre,代码行数:101,代码来源:archive.cpp
示例15: C32LOG5
void CCommSession::ServiceL(const RMessage2& aMessage)
/**
* Handle messages for this session.
*
* @param aMessage handle to the IPC message from the client
*/
{
C32LOG5(KC32Detail,_L8("CCommSession::ServiceL(), Session : 0x%x, IPC: %d (%S). Message: %08x"), this, aMessage.Function(), &TC32Log::C32RequestStr(aMessage.Function()),aMessage.Handle());
iComplete = ETrue;
const CC32WorkerThread& owner=C32WorkerThread();
CC32Dealer& c32Dealer = owner.DealerByRef();
if (c32Dealer.StartupFailed())
{
SafeComplete(aMessage, KErrNotReady);
return;
}
// TestImmediateShutdownPresent is only set when EImmediate shutdown is present, which is
// used only in testing phase.
if(c32Dealer.TestImmediateShutdownPresent())
{
User::Leave(KErrServerTerminated);
}
if((aMessage.Function()==ECommOpen)
||
(aMessage.Function()==ECommOpenWhenAvailable))
{
NewPortL(aMessage);
return;
}
#if defined (_DEBUG)
switch (aMessage.Function())
{
case ECommDbgMarkHeap:
__UHEAP_MARK;
SafeComplete(aMessage, KErrNone);
return;
case ECommDbgCheckHeap:
__UHEAP_CHECK(aMessage.Int0());
SafeComplete(aMessage, KErrNone);
return;
case ECommDbgMarkEnd:
__UHEAP_MARKENDC(aMessage.Int0());
SafeComplete(aMessage, KErrNone);
return;
case ECommDbgFailNext:
// We set the fail point for all heaps, rather than just the current Dealer. This could lead to a failure not related
// directly to whatever the client test code is trying to exercise but it all helps find bugs
c32Dealer.SetFailNextForAllHeaps(aMessage.Int0());
SafeComplete(aMessage, KErrNone);
return;
}
#endif
switch ((aMessage.Function()))
{
case ECommLoadCommModule:
{
TFileName fullCSYFilename;
TInt ret = Read(0,aMessage,fullCSYFilename);
if (ret != KErrNone)
{
C32LOG2(KC32Warning, _L8("ServiceL: LoadCommModule Read returned %d instead of KErrNone, cannot proceed"), ret);
PanicClient(EBadDescriptor,aMessage);
return;
}
ret = AddCSYExtension(fullCSYFilename,aMessage);
if(ret != KErrNone)
{
C32LOG2(KC32Warning, _L8("ServiceL: LoadCommModule AddCSYExtension returned %d instead of KErrNone, cannot proceed"), ret);
return;
}
CommsFW::TWorkerId worker;
TBuf8<KMaxFileName> fileName8;
fileName8.Copy(fullCSYFilename);
TBool found = iThreadManager->FindThreadByFileName(fileName8, worker);
if(!found)
{
worker = iThreadManager->iDefaultThreadIndex;
}
if(c32Dealer.WorkerExists(worker))
{
LoadCommModuleL(aMessage,worker,!found,fullCSYFilename);
}
else
{
C32LOG2(KC32Dealer,_L8("ServiceL: LoadCommModule requires worker %d. This worker does not exist so starting"),worker);
ret = c32Dealer.LoadCPMOnLoadCommModule(worker);
if ((ret!=KErrNone) && (ret!=KErrInUse))
{
// only likely return codes here are KErrNoMemory or KErrNotFound if
// the RS server could not be found - which means system is probably in pretty bad state (ie, no memory)
//.........这里部分代码省略.........
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:101,代码来源:CS_SES.CPP
示例16: StdinProcess
int Server::StdinProcess(){
std::string buf;
if(Read(STDIN_FILENO, buf) <= 0) return -1;
if(buf == "exit") Close();
return 0;
}
开发者ID:allenwhale,项目名称:np,代码行数:6,代码来源:server.cpp
示例17: Read
wxArrayString ConfigManager::ReadArrayString(const wxString& name)
{
wxArrayString as;
Read(name, &as);
return as;
}
开发者ID:469306621,项目名称:Languages,代码行数:6,代码来源:configmanager.cpp
示例18: Clear_terminal
void MainWND::OnEnter(wxCommandEvent &event)
{
// bool loop_check;
if(Commandline->GetValue()== wxT("read")) {
Clear_terminal(); SOFT_TRIG(); wxYield(); Read(true); wxYield();
} else if(Commandline->GetValue() == wxT("write0")) {
Clear_terminal(); LOAD_RAM_DATA(0); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("write1")) {
Clear_terminal(); LOAD_RAM_DATA(1); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("write2")) {
Clear_terminal(); LOAD_RAM_DATA(2); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("write3")) {
Clear_terminal(); LOAD_RAM_DATA(3); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("write4")) {
Clear_terminal(); LOAD_RAM_DATA(4); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("write5")) {
Clear_terminal(); LOAD_RAM_DATA(5); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("write6")) {
Clear_terminal(); LOAD_RAM_DATA(6); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("write7")) {
Clear_terminal(); LOAD_RAM_DATA(7); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("write8")) {
Clear_terminal(); LOAD_RAM_DATA(8); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("write9")) {
Clear_terminal(); LOAD_RAM_DATA(9); LOAD_PATTERN(); SOFT_TRIG(); wxYield();
} else if(Commandline->GetValue() == wxT("trig")) {
SOFT_TRIG(); TextFrame->AppendText(wxString::Format(wxT("sending software trigger...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("bank0")) {
set_register_bank_address(0); TextFrame->AppendText(wxString::Format(wxT("setting register bank address to 0...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("bank1")) {
set_register_bank_address(1); TextFrame->AppendText(wxString::Format(wxT("setting register bank address to 1...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("bank2")) {
set_register_bank_address(2); TextFrame->AppendText(wxString::Format(wxT("setting register bank address to 2...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("bank3")) {
set_register_bank_address(3); TextFrame->AppendText(wxString::Format(wxT("setting register bank address to 3...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("writemode0")) {
set_ram_write_mode(0); TextFrame->AppendText(wxString::Format(wxT("setting ram write mode to 0...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("writemode1")) {
set_ram_write_mode(1); TextFrame->AppendText(wxString::Format(wxT("setting ram write mode to 1...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("writemode2")) {
set_ram_write_mode(2); TextFrame->AppendText(wxString::Format(wxT("setting ram write mode to 2...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("writemode3")) {
set_ram_write_mode(3); TextFrame->AppendText(wxString::Format(wxT("setting ram write mode to 3...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("readmode0")) {
set_ram_read_mode(0); TextFrame->AppendText(wxString::Format(wxT("setting ram read mode to 0...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("readmode1")) {
set_ram_read_mode(1); TextFrame->AppendText(wxString::Format(wxT("setting ram read mode to 1...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("readmode2")) {
set_ram_read_mode(2); TextFrame->AppendText(wxString::Format(wxT("setting ram read mode to 2...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("readmode3")) {
set_ram_read_mode(3); TextFrame->AppendText(wxString::Format(wxT("setting ram read mode to 3...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("trigger0")) {
trigger_fiber_transfer(1); TextFrame->AppendText(wxString::Format(wxT("triggering fiber channel 0...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("trigger1")) {
trigger_fiber_transfer(2); TextFrame->AppendText(wxString::Format(wxT("triggering fiber channel 1...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("trigger2")) {
trigger_fiber_transfer(4); TextFrame->AppendText(wxString::Format(wxT("triggering fiber channel 2...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("trigger3")) {
trigger_fiber_transfer(8); TextFrame->AppendText(wxString::Format(wxT("triggering fiber channel 3...\n"))); wxYield();
} else if(Commandline->GetValue() == wxT("run")) {
TextFrame->AppendText(wxString::Format(wxT("running...\n"))); wxYield();
set_ram_read_mode(2);
set_ram_write_mode(2);
wxYield();
LOAD_RAM_DATA(6); LOAD_PATTERN(); SOFT_TRIG();
trigger_chipscope();
wxYield();
set_ram_read_mode(1);
set_ram_write_mode(0);
wxYield();
// trigger_fiber_transfer(8);
// trigger_fiber_transfer(1);
trigger_fiber_transfer(4);
// trigger_fiber_transfer(0); // turn it back off
wxYield();
set_ram_read_mode(2);
set_ram_write_mode(2);
wxYield();
SOFT_TRIG(); wxYield(); Read(true);
wxYield();
TextFrame->AppendText(wxString::Format(wxT("done\n"))); wxYield();
} else {
Send();
}
}
开发者ID:diqiuren,项目名称:idlab-daq,代码行数:85,代码来源:base.cpp
示例19: gethostbyname
bool CMgProxySocket::DoV4Connect( const char* server , int port )
{ //resolv ip locally
/*
+----+----+----+----+----+----+----+----+----+----+....+----+
| VN | CD | DSTPORT | DSTIP | USERID |NULL|
+----+----+----+----+----+----+----+----+----+----+....+----+
bytes: 1 1 2 4 variable 1
+----+----+----+----+----+----+----+----+
| VN | CD | DSTPORT | DSTIP |
+----+----+----+----+----+----+----+----+
bytes: 1 1 2 4
VN is the version of the reply code and should be 0. CD is the result
code with one of the following values:
90: request granted
91: request rejected or failed
92: request rejected becasue SOCKS server cannot connect to
identd on the client
93: request rejected because the client program and identd
report different user-ids.
*/
unsigned char buf[ 256 ];
struct hostent *hp;
hp = gethostbyname( server );
if ( !hp )
{
m_nLastError = 0x02; //??
return false;
}
if ( hp->h_addrtype != AF_INET )
{ //neither AF_INET nor AF_INET6
m_nLastError = 0x03; //??
return false;
}
short iport = htons( ( short ) port );
buf[ 0 ] = 0x04;
buf[ 1 ] = 0x01;
memcpy( buf + 2, &iport, 2 );
memcpy( buf + 4, ( void* ) ( hp->h_addr ), 4 );
memcpy( buf + 8, m_ProxyUser.c_str(), m_ProxyUser.length() );
buf[ 8 + m_ProxyUser.length() ] = 0;
if ( !Send( buf, 8 + m_ProxyUser.length() + 1 ) )
{
return false;
}
int nret = Read( buf, 256 );
if ( nret != 8 )
{
return false;
}
if ( buf[ 0 ] != 0 )
{
return false;
}
if ( buf[ 1 ] == 90 )
{
return true;
}
else if ( buf[ 1 ] == 91 )
{
return false;
}
else if ( buf[ 1 ] == 92 )
{
return false;
}
else if ( buf[ 1 ] == 93 )
{
return false;
}
return false;
}
开发者ID:artificerpi,项目名称:multiget,代码行数:89,代码来源:mgproxysocket.cpp
示例20: ncat_listen_dgram
//.........这里部分代码省略.........
if (nbytes < 0) {
loguser("%s.\n", socket_strerror(socket_errno()));
close(socket_n);
return 1;
}
ncat_log_recv(buf, nbytes);
}
if (o.debug > 1)
logdebug("Valid Connection from %d\n", socket_n);
conn_inc++;
/*
* We're using connected udp. This has the down side of only
* being able to handle one udp client at a time
*/
Connect(socket_n, &remotess.sockaddr, sslen);
/* clean slate for buf */
zmem(buf, sizeof(buf));
/* are we executing a command? then do it */
if (o.cmdexec) {
struct fdinfo info = { 0 };
info.fd = socket_n;
if (o.keepopen)
netrun(&info, o.cmdexec);
else
netexec(&info, o.cmdexec);
continue;
}
FD_SET(socket_n, &read_fds);
FD_SET(STDIN_FILENO, &read_fds);
fdmax = socket_n;
/* stdin -> socket and socket -> stdout */
while (1) {
fd_set fds;
fds = read_fds;
if (o.debug > 1)
logdebug("udp select'ing\n");
if (o.idletimeout > 0)
ms_to_timeval(tvp, o.idletimeout);
fds_ready = fselect(fdmax + 1, &fds, NULL, NULL, tvp);
if (fds_ready == 0)
bye("Idle timeout expired (%d ms).", o.idletimeout);
if (FD_ISSET(STDIN_FILENO, &fds)) {
nbytes = Read(STDIN_FILENO, buf, sizeof(buf));
if (nbytes < 0) {
loguser("%s.\n", strerror(errno));
return 1;
} else if (nbytes == 0) {
return 0;
}
if (o.crlf)
fix_line_endings((char *) buf, &nbytes, &tempbuf, &crlf_state);
if (!o.recvonly) {
if (tempbuf != NULL)
n = send(socket_n, tempbuf, nbytes, 0);
else
n = send(socket_n, buf, nbytes, 0);
if (n < nbytes) {
loguser("%s.\n", socket_strerror(socket_errno()));
close(socket_n);
return 1;
}
ncat_log_send(buf, nbytes);
}
if (tempbuf != NULL) {
free(tempbuf);
tempbuf = NULL;
}
}
if (FD_ISSET(socket_n, &fds)) {
nbytes = recv(socket_n, buf, sizeof(buf), 0);
if (nbytes < 0) {
loguser("%s.\n", socket_strerror(socket_errno()));
close(socket_n);
return 1;
}
ncat_log_recv(buf, nbytes);
if (!o.sendonly)
Write(STDOUT_FILENO, buf, nbytes);
}
zmem(buf, sizeof(buf));
}
}
return 0;
}
开发者ID:EliseuTorres,项目名称:nmap,代码行数:101,代码来源:ncat_listen.c
注:本文中的Read函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论