AAbstractSocket#
Base class for all sockets.
| Header: | #include <AUI/Network/AAbstractSocket.h> |
| CMake: | aui_link(my_target PUBLIC aui::network) |
Detailed Description#
Holds the native socket handle and the local address. The handle is released when the socket is destroyed, or earlier
with close(). Sockets are not copyable.
Failures are reported with exceptions derived from AIOException. A blocked thread that is interrupted (see
AThread::interrupt) while waiting in a socket call gets AThread::Interrupted, which is the way to stop a thread
blocked in ATcpSocket or AUdpSocket reads.
Concrete sockets: ATcpSocket, ATcpServerSocket, AUdpSocket.
Public Methods#
bind#
Binds socket for port. Used for ATcpServerSocket and AUdpSocket
- Arguments
bindingPortport
Examples:
examples/app/fractal/src/FractalView.cpp
Fractal Example — Fractal viewer application demonstrating usage of custom shaders.
void FractalView::render(ARenderContext context) {
AView::render(context);
mShader.use();
mTexture->bind();
context.render.rectangle(ACustomShaderBrush {}, { 0, 0 }, getSize());
}
void FractalView::onLayout(glm::ivec2 size) {
AView::onLayout(size);
createSocket#
Creates socket handle.
init#
Initialise socket
Examples:
examples/ui/embedded_sdl/src/main.cpp
SDL3 — This code demonstrates how to integrate the AUI Framework with SDL3 to create a window with OpenGL rendering.
setTimeout#
Sets the receive timeout.
A blocked read that waits longer than timeout fails. Zero disables the timeout.