Skip to content

AAbstractSocket#

Base class for all sockets.

Header:#include <AUI/Network/AAbstractSocket.h>
CMake:aui_link(my_target PUBLIC aui::network)

Public Methods#

bind#


void AAbstractSocket::bind(uint16_t bindingPort)

Binds socket for port. Used for ATcpServerSocket and AUdpSocket

Arguments
bindingPort
port

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::setSize(glm::ivec2 size) {
    AView::setSize(size);

createSocket#


virtual int AAbstractSocket::createSocket()

Creates socket handle.

init#


void AAbstractSocket::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.

        SDL_GL_DestroyContext(gl_context);
        SDL_DestroyWindow(sdl_window);
    }

    void init(std::unique_ptr<EmbedRenderingContext>&& context) {
        windowInit(std::move(context));

        int width = 0;
        int height = 0;
        SDL_GetWindowSizeInPixels(sdl_window, &width, &height);