CSFML - C binding of the Simple and Fast Multimedia Library

CSFML 3.0.0

- Main Page
- Classes
- Files

- File List
- File Members

Loading...
Searching...
No Matches
UdpSocket.h
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2024 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28// Headers
30#include <CSFML/Network/Export.h>
31
32#include <CSFML/Network/IpAddress.h>
33#include <CSFML/Network/SocketStatus.h>
34#include <CSFML/Network/Types.h>
35
36#include <stddef.h>
37
38
45 CSFML_NETWORK_API sfUdpSocket* sfUdpSocket_create(void);
46
53 CSFML_NETWORK_API void sfUdpSocket_destroy(const sfUdpSocket* socket);
54
71 CSFML_NETWORK_API void sfUdpSocket_setBlocking(sfUdpSocket* socket, bool blocking);
72
81 CSFML_NETWORK_API bool sfUdpSocket_isBlocking(const sfUdpSocket* socket);
82
94 CSFML_NETWORK_API unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket* socket);
95
114 CSFML_NETWORK_API sfSocketStatus sfUdpSocket_bind(sfUdpSocket* socket, unsigned short port, sfIpAddress address);
115
126 CSFML_NETWORK_API void sfUdpSocket_unbind(sfUdpSocket* socket);
127
144 CSFML_NETWORK_API sfSocketStatus
145 sfUdpSocket_send(sfUdpSocket* socket, const void* data, size_t size, sfIpAddress remoteAddress, unsigned short remotePort);
146
167 CSFML_NETWORK_API sfSocketStatus sfUdpSocket_receive(
168 sfUdpSocket* socket,
169 void* data,
170 size_t size,
171 size_t* received,
172 sfIpAddress* remoteAddress,
173 unsigned short* remotePort);
174
190 CSFML_NETWORK_API sfSocketStatus
191 sfUdpSocket_sendPacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress remoteAddress, unsigned short remotePort);
192
207 CSFML_NETWORK_API sfSocketStatus
208 sfUdpSocket_receivePacket(sfUdpSocket* socket, sfPacket* packet, sfIpAddress* remoteAddress, unsigned short* remotePort);
209
217 CSFML_NETWORK_API unsigned int sfUdpSocket_maxDatagramSize(void);
IpAddress.h
Export.h
CSFML_NETWORK_API
#define CSFML_NETWORK_API
Definition Network/Export.h:42
Types.h
sfPacket
struct sfPacket sfPacket
Definition Network/Types.h:35
sfUdpSocket
struct sfUdpSocket sfUdpSocket
Definition Network/Types.h:39
SocketStatus.h
sfSocketStatus
sfSocketStatus
Define the status that can be returned by the socket functions.
Definition SocketStatus.h:32
sfUdpSocket_receive
sfSocketStatus sfUdpSocket_receive(sfUdpSocket *socket, void *data, size_t size, size_t *received, sfIpAddress *remoteAddress, unsigned short *remotePort)
Receive raw data from a remote peer with a UDP socket.
sfUdpSocket_getLocalPort
unsigned short sfUdpSocket_getLocalPort(const sfUdpSocket *socket)
Get the port to which a UDP socket is bound locally.
sfUdpSocket_destroy
void sfUdpSocket_destroy(const sfUdpSocket *socket)
Destroy a UDP socket.
sfUdpSocket_bind
sfSocketStatus sfUdpSocket_bind(sfUdpSocket *socket, unsigned short port, sfIpAddress address)
Bind a UDP socket to a specific port.
sfUdpSocket_isBlocking
bool sfUdpSocket_isBlocking(const sfUdpSocket *socket)
Tell whether a UDP socket is in blocking or non-blocking mode.
sfUdpSocket_setBlocking
void sfUdpSocket_setBlocking(sfUdpSocket *socket, bool blocking)
Set the blocking state of a UDP listener.
sfUdpSocket_receivePacket
sfSocketStatus sfUdpSocket_receivePacket(sfUdpSocket *socket, sfPacket *packet, sfIpAddress *remoteAddress, unsigned short *remotePort)
Receive a formatted packet of data from a remote peer with a UDP socket.
sfUdpSocket_unbind
void sfUdpSocket_unbind(sfUdpSocket *socket)
Unbind a UDP socket from the local port to which it is bound.
sfUdpSocket_send
sfSocketStatus sfUdpSocket_send(sfUdpSocket *socket, const void *data, size_t size, sfIpAddress remoteAddress, unsigned short remotePort)
Send raw data to a remote peer with a UDP socket.
sfUdpSocket_create
sfUdpSocket * sfUdpSocket_create(void)
Create a new UDP socket.
sfUdpSocket_sendPacket
sfSocketStatus sfUdpSocket_sendPacket(sfUdpSocket *socket, sfPacket *packet, sfIpAddress remoteAddress, unsigned short remotePort)
Send a formatted packet of data to a remote peer with a UDP socket.
sfUdpSocket_maxDatagramSize
unsigned int sfUdpSocket_maxDatagramSize(void)
Return the maximum number of bytes that can be sent in a single UDP datagram.
sfIpAddress
Encapsulate an IPv4 network address.
Definition IpAddress.h:40