⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 udpsocket.cpp

📁 2009 ROBOCUP 仿真2DSERVER 源码
💻 CPP
字号:
// -*-c++-*-/***************************************************************************                          udpsocket.cpp  -  A simple udp socket class                             -------------------    begin                : 08-JAN-2003    copyright            : (C) 2003 by The RoboCup Soccer Server                           Maintenance Group.    email                : sserver-admin@lists.sourceforge.net***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU LGPL as published by the Free Software  * *   Foundation; either version 2 of the License, or (at your option) any  * *   later version.                                                        * *                                                                         * ***************************************************************************/#ifdef HAVE_CONFIG_H#include <config.h>#endif#include "udpsocket.hpp"#include <sys/types.h>#ifdef HAVE_SYS_SOCKET_H#include <sys/socket.h>#endif#include <cerrno>#ifdef HAVE_NETINET_IN_H#include <netinet/in.h>#endif#ifdef HAVE_WINSOCK2_H#include "Winsock2.h"#endif#include <iostream>namespace rcss {namespace net {UDPSocket::UDPSocket(){    open();}UDPSocket::UDPSocket( SocketDesc & s )    : Socket( s ){}UDPSocket::UDPSocket( const Addr & addr ){    open();    bind( addr );}UDPSocket::UDPSocket( const Addr & addr,                      const Addr & dest ){    open();    bind( addr );    connect( dest );}boolUDPSocket::doOpen( SocketDesc & fd ){    close();    fd = ::socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP );    return fd >= 0;}}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -