473,320 Members | 1,699 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,320 software developers and data experts.

Socket class done the C++ way

I've been trying to make a socket class. So far, it's been up and down,
getting many different pieces of advice along the way.
Now I've made it a bit functional, although it is doing nothing to check
for errors, and is probably done terribly badly with fds and FILE*s.

Now, I've found out it should inherit the streambuf class. I've found a
class doing this, but it is way too complicated for my learning
capabilities.

Could someone please direct me to the Path that is C++?

I'm not including code, since it's probably crappy, and uses a lot of
files not relevant to this question. If you want it, just ask.

--
MikaelSh
Jan 26 '06 #1
5 1637
On Thu, 26 Jan 2006 22:53:25 +0100, "Mikael S. H."
<mi****@alminde.org> wrote:
I've been trying to make a socket class. So far, it's been up and down,
getting many different pieces of advice along the way.
Now I've made it a bit functional, although it is doing nothing to check
for errors, and is probably done terribly badly with fds and FILE*s.

Now, I've found out it should inherit the streambuf class. I've found a
class doing this, but it is way too complicated for my learning
capabilities.

Could someone please direct me to the Path that is C++?


http://www.msobczak.com/prog/bin/sockets.zip
Jan 27 '06 #2
Mikael S. H. wrote:
I've been trying to make a socket class. So far, it's been up and down,
getting many different pieces of advice along the way.
Now I've made it a bit functional, although it is doing nothing to check
for errors, and is probably done terribly badly with fds and FILE*s.

Now, I've found out it should inherit the streambuf class. I've found a
class doing this, but it is way too complicated for my learning
capabilities.

Could someone please direct me to the Path that is C++?

I'm not including code, since it's probably crappy, and uses a lot of
files not relevant to this question. If you want it, just ask.


http://freshmeat.net/projects/csockets/

<quote>
C++ Sockets is a C++ wrapper for BSD-style sockets. Its features include
transparent SOCKS4 client support and asynchronous DNS. It implements
the TCP, UDP, ICMP, HTTP (GET, PUT, and POST), and HTTPS (using OpenSSL)
protocols.
</quote>

Regards,
Larry
Jan 27 '06 #3

Mikael S. H. wrote:

Now, I've found out it should inherit the streambuf class. I've found a
class doing this, but it is way too complicated for my learning
capabilities.


IMO Socket++ Library should satisfy your needs. Apart from
from being streamable it implements unix domain sockets
and internet sockets. I think it has been compiled on few
flavour of unix. For more information you can check out
the site.

http://members.aon.at/hstraub/linux/socket++/

Thank you,
Nitin Motgi

Jan 27 '06 #4

Mikael S. H. wrote:

I'm not including code, since it's probably crappy, and uses a lot of
files not relevant to this question. If you want it, just ask.


It's small and has very good examples that would help you a lot

Thank you,
Nitin Motgi

Jan 27 '06 #5
Mikael S. H. a écrit :
I've been trying to make a socket class. So far, it's been up and down,
getting many different pieces of advice along the way.
Now I've made it a bit functional, although it is doing nothing to check
for errors, and is probably done terribly badly with fds and FILE*s.

Now, I've found out it should inherit the streambuf class. I've found a
class doing this, but it is way too complicated for my learning
capabilities.

Could someone please direct me to the Path that is C++?

I'm not including code, since it's probably crappy, and uses a lot of
files not relevant to this question. If you want it, just ask.


You might want to check out ASIO too.
http://asio.sourceforge.net/
Jan 27 '06 #6

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

Similar topics

2
by: Gonçalo Rodrigues | last post by:
Hi, My setup is the following: I have socket s from which I want to read and write. So I made the following set up: There is a thread whose only job is to read. Any data read (from recv call)...
8
by: simon place | last post by:
Spent some very frustrating hours recoding to find a way of closing a server socket, i'd not thought it would be any problem, however, after complete failure and as a last resort, i looked at the...
4
by: flupke | last post by:
Hi, I have a gui (made in wxPython) that enables a user to connect to a server and issue some commands. The problem occurs when i try to disconnect the client. It exits but it doesn't return to...
1
by: John Sheppard | last post by:
Thanks to everyone that responded to my previous Socket Programming question. Now I have run into some behavior that I don't quite understand. Programming environment. VS.NET 2003, C#, Windows...
13
by: coloradowebdev | last post by:
i am working on basically a proxy server that handles requests via remoting from clients and executes transactions against a third-party server via TCP. the remoting site works like a champ. my...
9
by: zxo102 | last post by:
Hi everyone, I am using a python socket server to collect data from a socket client and then control a image location ( wxpython) with the data, i.e. moving the image around in the wxpython frame....
4
by: SpreadTooThin | last post by:
client: import socket s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("192.168.1.101", 8080)) print 'Connected' s.send('ABCD') buffer = s.recv(4) print buffer s.send('exit')
5
by: darthghandi | last post by:
I've created a class to listen to all interfaces and do a BeginAccept(). Once it gets a connection, it passes the connected socket off and stores it in a List. Next, it continues to listen for...
1
by: orehian | last post by:
Construct a one-time password system. · Write a server code and a client code. The server code takes as input a username and a one-time password from the client and then sends a message...
2
by: rayoflight | last post by:
This is how my test program works. Server will encrypt some text and sends it over to the client. The client will then decrypts it. However I have some problem decrypting it. When I play...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.