UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

#1 2008-09-20 12:07 AM

SubjectivelyObjective
Member
Registered: 2008-09-12
Posts: 3

Re: Reentrant tcp/socket Lib

Hi,

I'm creating a multithreaded TCP socket application.  I've been searching the web for a reentrant tcp/socket module that i can incorporate into my project, but i've had little success.  If anyone could provide any advice it would be greatly appreciated.  Thanks in advance!

-Eric

Offline

#2 2008-09-20 12:38 AM

jfriesne
Administrator
From: California
Registered: 2005-07-06
Posts: 348
Website

Re: Reentrant tcp/socket Lib

Hi Eric,

I think you'll need to provide more information before anyone can give you a good answer.  For example, what language are you programming in?  What platform(s) do you want to support?

The standard POSIX/BSD sockets API (socket(), bind(), connect(), send(), recv(), etc) included in all modern major operating systems works fine in multithreaded programs, in my experience... is there any reason why you don't want to use those calls directly?

-Jeremy

SubjectivelyObjective;25145 wrote:

Hi,

I'm creating a multithreaded TCP socket application.  I've been searching the web for a reentrant tcp/socket module that i can incorporate into my project, but i've had little success.  If anyone could provide any advice it would be greatly appreciated.  Thanks in advance!

-Eric

Offline

#3 2008-09-20 01:03 AM

SubjectivelyObjective
Member
Registered: 2008-09-12
Posts: 3

Re: Reentrant tcp/socket Lib

Hi Jeremy,

Thanks for the reply, please excuse my last post, I meant to include more information.  I was handling multi-tasking (in my brain) and I did not allocate enough resources to my previous post.  I will not make this mistake again.

I'm programming in C, and the app only needs to run on Linux version 2.6.18.

I actually completely misposted originally.  I'm not having any real problems with the standard posix socket library at the moment; what i really need is a reentrant SMTP library.  I ran into problems in my previous development iteration during the SMTP conversation, mainly in the error reporting, where I was doing a lot of memsets, string copies and file writes. 

I would just like to find a library that has sufficient error reporting for the SMTP conversation, but still with access to low level functions.  This way I can create the sockets and bind them according to my specification, but not have to worry about the SMTP conversation itself.  Does this make sense?

Thanks again, and sorry again for the poor initial post.

-Eric


jfriesne;25146 wrote:

Hi Eric,

I think you'll need to provide more information before anyone can give you a good answer.  For example, what language are you programming in?  What platform(s) do you want to support?

The standard POSIX/BSD sockets API (socket(), bind(), connect(), send(), recv(), etc) included in all modern major operating systems works fine in multithreaded programs, in my experience... is there any reason why you don't want to use those calls directly?

-Jeremy

Offline

#4 2008-09-20 01:15 AM

SubjectivelyObjective
Member
Registered: 2008-09-12
Posts: 3

Re: Reentrant tcp/socket Lib

Should i repost so the title is correct?

-Eric

Offline

#5 2008-09-20 07:40 PM

RobSeace
Administrator
From: Boston, MA
Registered: 2002-06-12
Posts: 3,829
Website

Re: Reentrant tcp/socket Lib

I would just like to find a library that has sufficient error reporting for the SMTP conversation, but still with access to low level functions. This way I can create the sockets and bind them according to my specification, but not have to worry about the SMTP conversation itself. Does this make sense?

I'm not sure why you'd want to create and bind() the client sockets...  I assume you
are talking about building a SMTP client, not a server, right??  In general, clients
shouldn't be bind()'ing their sockets at all, anyway...  You should let your OS do the
auto-binding at connect() time, based on the appropriate interface needed to reach
the destination address, and grab a random free ephemeral port, rather than use
a fixed port#...

I don't know of any SMTP lib that allows you to swap in your own socket to use...
But, libESMTP sounds like it would otherwise meet your needs...

If you truly need low-level access to the socket, perhaps you could just modify the
lib to add a way to get the access you need... *shrug*

Offline

Board footer

Powered by FluxBB