473,397 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

c++ socket library



Hi,
I am planning to write a TCP/IP server. I would like to know if
any socket library is available for c++ or I have to use the socket
function calls in C.

Dec 12 '07 #1
11 5247
ACE

"mthread" <rj****@gmail.comwrote in message
news:86**********************************@t1g2000p ra.googlegroups.com...
>

Hi,
I am planning to write a TCP/IP server. I would like to know if
any socket library is available for c++ or I have to use the socket
function calls in C.
Dec 12 '07 #2
mthread a écrit :
>
Hi,
I am planning to write a TCP/IP server. I would like to know if
any socket library is available for c++ or I have to use the socket
function calls in C.
There is no standard socket library in C++. You can google for
standalone library or you can use a framework like: ACE, Poco, gtk+ ...

Michael
Dec 12 '07 #3
On Wed, 12 Dec 2007 12:26:22 +0200, mthread <rj****@gmail.comwrote:
Hi,
I am planning to write a TCP/IP server. I would like to know if
any socket library is available for c++ or I have to use the socket
function calls in C.
Boost.Asio (see http://asio.sourceforge.net/; not yet part of the Boost
distribution although it has been accepted to Boost already).

Boris
Dec 12 '07 #4
On Dec 12, 12:26 pm, mthread <rjk...@gmail.comwrote:
Hi,
I am planning to write a TCP/IP server. I would like to know if
any socket library is available for c++ or I have to use the socket
function calls in C.
Besides Ace, QT also offers networking classes which are very easy to
use, you'd have to check out their licensing model though...
Dec 12 '07 #5
mthread wrote:
>

Hi,
I am planning to write a TCP/IP server. I would like to know if
any socket library is available for c++ or I have to use the socket
function calls in C.
People have pointed out that there are no socket facilities in C++.
There also are none in C either. It's all platforms-specific stuff.

Brian
Dec 12 '07 #6
"Default User" <de***********@yahoo.comwrote in news:5saulbF180f6cU1
@mid.individual.net:
People have pointed out that there are no socket facilities in C++.
There also are none in C either. It's all platforms-specific stuff.

Never heard of cross-platform libraries?

--
Tomás Ó hÉilidhe
Dec 12 '07 #7
Tomas S hIilidhe wrote:
"Default User" <de***********@yahoo.comwrote in news:5saulbF180f6cU1
@mid.individual.net:
People have pointed out that there are no socket facilities in C++.
There also are none in C either. It's all platforms-specific stuff.


Never heard of cross-platform libraries?
*plonk*

Brian
Dec 12 '07 #8
On Dec 13, 3:31 am, "Default User" <defaultuse...@yahoo.comwrote:
Tomas S hIilidhe wrote:
"Default User" <defaultuse...@yahoo.comwrote in news:5saulbF180f6cU1
@mid.individual.net:
People have pointed out that there are no socket facilities in C++.
There also are none in C either. It's all platforms-specific stuff.
Never heard of cross-platform libraries?

*plonk*

Brian
Hi,

thanx everyone for the help
Dec 13 '07 #9
mthread wrote:
On Dec 13, 3:31 am, "Default User" <defaultuse...@yahoo.comwrote:
Tomas S hIilidhe wrote:
"Default User" <defaultuse...@yahoo.comwrote in
news:5saulbF180f6cU1 @mid.individual.net:
People have pointed out that there are no socket facilities in
C++. There also are none in C either. It's all
platforms-specific stuff.
Never heard of cross-platform libraries?
plonk
thanx everyone for the help
Sure, let me know if there's anyone else I can plonk for you.

Brian
Dec 13 '07 #10
mthread ha scritto:
>
Hi,
I am planning to write a TCP/IP server. I would like to know if
any socket library is available for c++ or I have to use the socket
function calls in C.
I'm using: http://www.alhem.net/Sockets/
It has some glitches, but I choosed it for its light weight.

bye
av.
Dec 13 '07 #11
On Dec 12, 2:26 am, mthread <rjk...@gmail.comwrote:
Hi,
I am planning to write a TCP/IP server. I would like to know if
any socket library is available for c++ or I have to use the socket
function calls in C.

First understand the socket library -- how to use it in C to write
your TCP/IP server.
Then recognize that there are pairs of function calls like e.g. socket/
close. accept/close.
Such pairs create classes with the do-action in the constructor and
the undo action in the destructor. I call such classes resource-
wrappers.
The constructor should throw something derived from std::exception in
case of the call fails.
The object thrown should contain every error information provided by
the system:
e.g. errno and the name of the function call which failed and maybe
some user supplied string which explains what has been attempted to
do.
From the saved errno you get the system error string via strerror.
IN the constructor create a std::string which contains the final error
message the user will see.
The what() method of the exception class will return what is returned
from the std::string.c_str().
Then recognize that there are functions which can also fail but do not
create a resource, like e.g. read/write. These belong into what I call
functional-wrappers.
A function returning void and calling the function to be wrapped.
If the function to be wrapped fails, again throw something containing
all the error information.
Finally you can write your TCP/IP server using these wrappers. You
will have to write a single try-catch block to deal with errors. The
code you're writing using these wrappers does not deal with errors
anymore.
Dec 14 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bryan Olson | last post by:
Here's the problem: Suppose we use: import socket f = some_socket.makefile() Then: f.read() is efficient, but verbose, and incorrect (or at least does not play will with others);
7
by: Dario | last post by:
I have an unmanaged library that handle many TCP/IP connections. In my .NET application i want to test if there is input available on these connections. Using an existing function of the unmanaged...
1
by: J. Dudgeon | last post by:
Hello, I've written a server that acts as a proxy between the PC and the mainframe worlds. This server service is writting in C# w/.NET 1.1. The service is TCP/IP based and makes heavy use of...
4
by: faktujaa | last post by:
Hi, I am having some problem with callback used in socket implementation. private static void Connect(string strPrtrIPAddr, int intPrtrPort, ref Socket rsocClient) { try { // Create remote end...
2
by: Ed Fair | last post by:
Hi, I am having a name collision between a library call and a class I've created. My class is called "socket", it abstracts a TCP socket. In my constructors for my class, I am calling the...
4
by: Joe Kinsella | last post by:
The following code behaves differently from what I would expect: socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp); socket.Blocking = false;...
9
by: AA | last post by:
This is making me crazy!! Please, if some body can help me. I'm testing a ver simple socket client. In my test I just open and close a connection (in a loop) to my local IIS server (port 80)...
5
by: Arno | last post by:
reposted with the right microsoft managed newsgroup ID: Sorry for the inconvinience Hi, I've written a class for client-socket connection, but I get a lot of times the error message "Unable...
6
by: roblugt | last post by:
I have what I imagine is a well-known .Net networking problem, but even though I've Googled for some time I've not yet come across a thread where this has been fully explained... There is a...
11
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.