/** * Client send: * 2 - U8 - shared flag * * Server send: * 2 - U16 - framebuffer-width * 2 - U16 - framebuffer-height * 16 - PixelFormat - server-pixel-format * 4 - U32 - name-length * name-length - U8 array - name-string */ void RemoteViewerCore::clientAndServerInit() { if (m_sharedFlag) { m_logWriter.info(_T("Setting share flag in on...")); } else { m_logWriter.info(_T("Setting share flag is off...")); } m_output->writeUInt8(m_sharedFlag); m_output->flush(); m_logWriter.debug(_T("Shared flag is set")); UINT16 width = m_input->readUInt16(); UINT16 height = m_input->readUInt16(); Dimension screenDimension(width, height); PixelFormat serverPixelFormat = readPixelFormat(); { AutoLock al(&m_fbLock); setFbProperties(&screenDimension, &serverPixelFormat); } UINT32 sizeInBytes = m_input->readUInt32(); std::vector<const char> buffer(sizeInBytes + 1); m_input->read(&buffer.front(), sizeInBytes); buffer[sizeInBytes] = '\0'; AnsiStringStorage ansiStr; ansiStr.setString(&buffer[0]); ansiStr.toStringStorage(&m_remoteDesktopName); m_logWriter.info(_T("Server remote name: %s"), m_remoteDesktopName.getString()); if (m_isTight) { m_logWriter.detail(_T("Reading tight capabilities")); readCapabilities(); } }