MCPcopy Create free account
hub / github.com/SFML/SFML / send

Method send

src/SFML/Network/Ftp.cpp:619–653  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

617
618////////////////////////////////////////////////////////////
619void Ftp::DataChannel::send(std::istream& stream)
620{
621 // Send data
622 std::array<char, 1024> buffer{};
623 std::size_t count = 0;
624
625 for (;;)
626 {
627 // read some data from the stream
628 stream.read(buffer.data(), buffer.size());
629
630 if (!stream.good() && !stream.eof())
631 {
632 err() << "FTP Error: Reading from the file has failed" << std::endl;
633 break;
634 }
635
636 count = static_cast<std::size_t>(stream.gcount());
637
638 if (count > 0)
639 {
640 // we could read more data from the stream: send them
641 if (m_dataSocket.send(buffer.data(), count) != Socket::Status::Done)
642 break;
643 }
644 else
645 {
646 // no more data: exit the loop
647 break;
648 }
649 }
650
651 // Close the data socket
652 m_dataSocket.disconnect();
653}
654
655} // namespace sf

Callers 13

sendRequestMethod · 0.45
queryDnsFunction · 0.45
uploadMethod · 0.45
sendCommandMethod · 0.45
handleSendMethod · 0.45
runUdpServerFunction · 0.45
runUdpClientFunction · 0.45
runTcpServerFunction · 0.45
runTcpClientFunction · 0.45
onProcessSamplesMethod · 0.45

Calls 3

eofMethod · 0.80
readMethod · 0.45
disconnectMethod · 0.45

Tested by

no test coverage detected