Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
52 user(s) are online (35 user(s) are browsing Forums)

Members: 0
Guests: 52

more...

Headlines

 
  Register To Post  

Solved; IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
Way is Connect giving me a error 78 when running inside a new process?
it works fine when running from main.

my Class

namespace Net
{

    
struct SocketFlags
    
{
        
int None;
    } 
SocketFlags = {0};

    class 
SocketType
    
{
        public:
            static const 
int Stream SOCK_STREAM;
    };

    class 
ProtocolType
    
{
        public:
            static const 
int Tcp IPPROTO_TCP;
            static const 
int Udp IPPROTO_UDP;
    };

    class 
AddressFamily
    
{
        public:
            static const 
int InterNetwork AF_INET;
    }; 

    class 
IPAddress
    
{
        public:

            
int AddressFamily;
            
unsigned char ipv4[4];
        
            
IPAddress()
            {
                
AddressFamily = -1;
                
bzero(ipv4,4);
            }

            ~
IPAddress()
            {
            }

            
void ToIP4(__BYTE *dataint af)
            {
                
memcpy(ipv4,data,4);
                
AddressFamily af;
            }

            
string ToString()
            {
                
char tmpchr[1000];
                
string temp;

                
sprintftmpchr,"%d.%d.%d.%d"ipv4[0], ipv4[1], ipv4[2], ipv4[3]);
                
temp tmpchr;

                return 
temp;
            }

            
bool operator==(int param)
            {
                return (
AddressFamily ==  param) ? true false;
            };
    };


    class 
IPEndPoint
    
{
        public:
            
IPEndPoint(IPAddress ipint port)
            {

            }

    };

    class 
ListIPAddress
    
{
            
std::vector<IPAddressip_list;
        public:
            
int Length;

            
ListIPAddress()
            {
                
Length 0;
            }

            ~
ListIPAddress()
            {
            }

            
void create(int n)
            {
                
IPAddress new_ip;        
                
Length n;

                
ip_list.empty();

                
printf("Create ListIPAddress x %d\n",n);

                while (
n--)
                {
                    
ip_list.push_back(new_ip);
                }
            }

            
IPAddress &operator[] (int pos)
            {
                return 
ip_list[pos];
            }    
    };

    class 
IPHostEntry
    
{
        public:

            
char    *h_name;       /* official name of host */
            
char    **h_aliases;   /* alias list */
            
ListIPAddress AddressList;
            
long    h_addrtype;    /* host address type */
            
long    h_length;      /* length of address */

            
IPHostEntry()
            {
                
h_name=null
                
h_aliases=null;
                
h_addrtype 0;
                
h_length 0;
            }

            ~
IPHostEntry()
            {
                if  (
h_namefree(h_name);

                if (
h_aliases)
                {
                    for (
char **ptr h_aliases; *ptrptr++)
                    {
                        
free(*ptr);
                    }
                }
            }
    };


    class 
Dns
    
{
        public:
            static 
IPHostEntry GetHostEntry(string &name)
            {
                
IPHostEntry ent;
                
struct hostent *aent null;
                
int pos,cnt 0;
                
char *IP;


                if (
name.ToChars() == NULL)
                {
                    
printf("name is bad, string should never be Zero\n");
                    return 
ent;
                }

                
printf("** 1 **\n");

                
printf("Name to find: %s\n"name.ToChars() );

                
printf("** 2 **\n");

                if (!
ISocket)
                {
                    
IDOS->Printf("no IScoket, GetHostEntry(string &name) failed\n");
                    return 
ent;
                }

                
printf("ISocket %x\n",ISocket);

                
// not thread safe!!, it sucks!!!, returns some static ptr
                
if ( aent ISocket -> gethostbyname(name.ToChars()) )
                {

                
printf("** 3 **\n");

                    for (
__BYTE **addr aent -> h_addr_list ; *addr addr++ ) cnt++;

                    
ent.AddressList.create(cnt);
                    
ent.AddressList.Length cnt;

                
printf("** 4 **\n");

                    
pos 0;
                    for (
__BYTE **addr aent -> h_addr_list ; *addr addr++ )
                    {
                        
IP = (char *) *addr;                    
                        
ent.AddressList[pos].ToIP4( *addr AddressFamily::InterNetwork );
                        
pos++;
                    }
                }

                return 
ent;
            }
    };

    class 
Socket
    
{
        private:
            
struct sockaddr_in addr;
            
int addrlen;
        public:
            
int socketfd;
            
int SocketFlags;
            
int ReceiveTimeout;
            
int SendTimeout;

            
Socket()
            {
                
bzero(&addr,sizeof(struct sockaddr_in));

                if (
ISocket)
                {
                    
socketfd ISocket -> socket(AF_INETSOCK_STREAMIPPROTO_TCP );
                    
addr.sin_family AF_INET;
                }
                else
                {
                    
printf("Socket::Socket() Interface ""ISocket"" not ready for use!!!!\n");
                }
            }

            
Socket(int address_familyint scoket_typeint protocol_type)
            {
                
bzero(&addr,sizeof(struct sockaddr_in));

                if (
ISocket)
                {
                    
socketfd ISocket -> socket(address_familyscoket_typeprotocol_type);
                    
addr.sin_family address_family;
                }
                else
                {
                    
printf("Socket::Socket() Interface ""ISocket"" not ready for use!!!!\n");
                }
            }

            ~
Socket()
            {
            }

            
void Bind(IPEndPoint *EndPoint)
            {
            }

            
void Listen(int somevalue)
            {
            }

            
Socket *Accept()
            {
            }

            
int Receive(bytes &memint Lengthuint32 flags
            {
                
int n,p;

                
ISocket -> recv(socketfdmem.memLength,
//                    MSG_OOB);
                    
MSG_WAITALL);

                if (
n==-1)
                {
                    throw 
errno;
                }

                return 
n;
            };

            
void Send(bytes &mem int offsetint lengthint flags)
            {
                
int n;
                
ISocket-> send(socketfdmem.mem length,
//                    MSG_OOB);
                    
MSG_WAITALL);

                if (
n==-1)
                {
                    
printf("we got return value -1, so we throw error\n\n");
                    throw 
errno;
                }
            }

            
void Send(bytes &mem)
            {
                
int n;
                
ISocket-> send(socketfdmem.mem mem.Length,
//                    MSG_OOB);
                    
MSG_WAITALL);

                if (
n==-1)
                {
                    
printf("we got return value -1, so we throw error\n");
                    throw 
errno;
                }
            }

            
void Close()
            {
                
ISocket -> CloseSocket(socketfd);
            }

            
void Connect(IPAddress &IP int port)
            {
                
int e;
                
int keepalive;

                
printf("Connect to %s\n",IP.ToString().ToChars());

                
addr.sin_addr.s_addr inet_addr(IP.ToString().ToChars());
                
addr.sin_port htons(port);

                
struct TimeVal tv;


                
printf("ReceiveTimeout = %d\n",ReceiveTimeout);
                
printf("SendTimeout = %d\n",SendTimeout);
#if 0
                
tv.Seconds 0;
                
tv.Microseconds ReceiveTimeout;
                
ISocket -> setsockopt(socketfdSOL_SOCKETSO_RCVTIMEO, (void *) &tv,sizeof(tv) );

                
tv.Seconds 0;
                
tv.Microseconds SendTimeout;
                
ISocket -> setsockopt(socketfdSOL_SOCKETSO_SNDTIMEO, (void *) &tv,sizeof(tv) );
#endif
#if 1
                
keepalive true;
                
ISocket -> setsockopt(socketfdSOL_SOCKETSO_KEEPALIVE,  &keepalive sizeof(keepalive) );
#endif
                
ISocket -> connect(socketfd,(sockaddr*) &addrsizeof(struct sockaddr_in) );

                if (
e!=0)
                {
                    throw 
errno;
                }
            }
    };
}


my threading class

namespace Threading
{
    
int32 ThreadStart_process(STRPTR argsint32 length,APTR execbase);
    
int32 DispatcherTimer_process(STRPTR argsint32 length,APTR execbase);    


    
struct ThreadState
    
{
        
int Stopped;
    } 
ThreadState = {0};

    class 
ThreadStart
    
{
        public:

            
void (*func) ();

            
ThreadStart(ThreadStart &Other)
            {
                
func NULL;
            }

            
ThreadStart()
            {
                
func NULL;
            }

            
ThreadStart(void (&fn)())
            {
                
func fn;
            }
    };

    class 
Thread
    
{
            
char str[30];
            
struct Process *proc;

        public:
            
int ThreadState;
            
bool IsAlive;
            
ThreadStart *_ThreadStart;

            
Thread()
            {
                
_ThreadStart NULL;
                
proc NULL;
            }

            
ThreadThreadStart *TreadStart )
            {
                
_ThreadStart TreadStart;
                
proc NULL;
            }

            ~
Thread()
            {
                
Abort();                
            }

            static 
void Sleep(int sec)
            {
                
IDOS->Delay(sec);
            }

            
void Start()
            {
                
sprintf(str,"%08x\n",this);
    
                
proc IDOS->CreateNewProcTags(
                    
NP_EntryThreadStart_process
                    
NP_Arguments, (char *) str,
                    
NP_Childtrue,
                    
TAG_END);

                
IsAlive true;
            }

            
void Abort()
            {
                
printf("Delete: DispatcherTimer()\n");

                if (
proc)
                {
                    
printf("asked sub process to quit\n");
                    
IExec -> Signal( &proc -> pr_Task,SIGBREAKF_CTRL_E);
                }

                do
                {
                    
IDOS -> Delay(1);
                }    while (
IsAlive == true);
            }
    };



    class 
Timer
    
{
        private:

            
struct MsgPort            *TimerMP;
            
bool device_open    ;

        public:

            
struct TimeRequest        *TimerIO;

            
Timer()
            {
                
TimerIO NULL;

                
TimerMP IExec->CreateMsgPort();
                if (!
TimerMP)  return;

                
TimerIO = (struct TimeRequest *) IExec->CreateIORequest(TimerMP,sizeof(struct TimeRequest));
                if (!
TimerIOIExec->DeleteMsgPort(TimerMP);

                if (
IExec->OpenDevice("timer.device",UNIT_VBLANK,(struct IORequest *) TimerIO,0L)==0)
                {
                    
device_open true;
                }
            }

            ~
Timer()
            {
                if (
device_open==TRUE)
                {
                    
IExec->CloseDevice((struct IORequest *) TimerIO);
                    
device_open=FALSE;
                }

                if (
TimerIO)
                {
                    
IExec->DeleteIORequest((struct IORequest *) TimerIO);
                    
TimerIO NULL;
                }

                if (
TimerMP
                {
                    
IExec->DeleteMsgPort(TimerMP);
                    
TimerMP NULL;
                }                
            }
    };





    class 
DispatcherTimer
    
{
            
struct Process *proc;
            
STRPTR args;
            
char str[30];

        public:

            
int IsEnabled

            
EventHandler *Tick;
            
TimeSpan *Interval;

            
DispatcherTimer()
            {
                
printf("New: DispatcherTimer()\n");

                
proc NULL;
            }

            
DispatcherTimer(DispatcherTimer *other)
            {
                
printf("SHIT: asked about a copy of the  DispatcherTimer, request ignored\n");
                
proc NULL;
            }

            ~
DispatcherTimer()
            {
                
Stop();
            }

            
void Start()
            {
                
sprintf(str,"%08x\n",this);
                
args = (char *) str;

                
proc IDOS->CreateNewProcTags(
                    
NP_EntryDispatcherTimer_process
                    
NP_Argumentsargs,
                    
NP_Childtrue,
                    
TAG_END);

                
IsEnabled true;
            }

            
void Stop()
            {
                
printf("Delete: DispatcherTimer()\n");

                if (
proc)
                {
                    
printf("asked sub process to quit\n");
                    
IExec -> Signal( &proc -> pr_Task,SIGBREAKF_CTRL_E);
                }

                do
                {
                    
IDOS -> Delay(1);
                }    while (
IsEnabled == true);
            }
    };

    
int32 ThreadStart_process(STRPTR argsint32 length,APTR execbase)
    {
        
Thread *self;
        
Timer time;
        
int cnt 0;
        
int Seconds 0;

        
sscanf(args"%08x", &self);

        if (
ISocketISocket -> Obtain();

        
self -> _ThreadStart -> func();

        if (
ISocketISocket -> Release();

        
self -> IsAlive false;
    }

    
int32 DispatcherTimer_process(STRPTR argsint32 length,APTR execbase)
    {
        
DispatcherTimer *self;
        
Timer time;
        
int cnt 0;
        
int Seconds 0;

        
sscanf(args"%08x", &self);
        while (
self -> IsEnabled == true)
        {
            if (
self -> Interval)
            {
                
Seconds self -> Interval -> Seconds;
                
Seconds += (self -> Interval -> Minutes) * 60;
                
Seconds += (self -> Interval -> Hours) * 60 60;

                
time.TimerIO -> Request.io_Command TR_ADDREQUEST;
                
time.TimerIO -> Request.io_Flags IOF_QUICK;
                
time.TimerIO -> Time.Seconds Seconds;
                
time.TimerIO -> Time.Microseconds 0

                if (
self->Tick)
                {
                    if (
self -> Tick -> func)
                    {
                        
self->Tick -> func();
                    }
                }

                
IExec -> DoIO((struct IORequest *) time.TimerIO);

            }
            else
            {
                
printf("%d\n",cnt);
                
cnt 1-cnt;

                
IDOS -> Delay(1);
            }

            if(
IExec->SetSignal(0L,SIGBREAKF_CTRL_E) & SIGBREAKF_CTRL_E) break;
        }    
        
        
self -> IsEnabled false;
    }
}



my code:

socket = new Socket(ipAddress.AddressFamilySocketType::StreamProtocolType::Tcp);

        try
        {
            
socket->ReceiveTimeout 50000// wait for 1000 milliseconds
            
socket->SendTimeout 50000;
            
socket->Connect(ipAddress8080);
        }
        catch (
Exception e)
        {
            
printf("%s: Error connecting, error: (%d) %s\n" ,__FUNCTION__estrerror(e));
            
delete socket;
            return 
false;
        }


Output:


Connect to 192.168.2.192
send_file: Error connecting, error: (78) Function not implemented


Edited by LiveForIt on 2014/2/24 14:18:01
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Supreme Council
Supreme Council


See User information
I think this comes from the fact you cannot "share" bsdsocket data from one process to another. The Process that creates the socket is the only one able to work on that socket.

This is mentioned in the autodoc IIRC.

Simon

Comments made in any post are personal opinion, and are in no-way representative of any commercial entity unless specifically stated as such.
----
http://codebench.co.uk
Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Quite a regular
Quite a regular


See User information
@LiveForIt

In your code I can't see where you are opening bsdsocket.library and obtaining its interface. You quoted some threading code so despite your other code does not seem to use it I assume you do in your actual program, so this may be your problem, and even then remember sockets are *not* shareable across processes by default, you'll need to either write a socket server either enable the sharing functionnality in bsdsocket (see Autodocs). Also remember that each process *must* open/close its own libraries/interfaces.

Back to a quiet home... At last
Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@Rigo

as you see in "my Code", the Socket is created at the first line before connecting, it is not shared.

I think, I should condense the code more, to make it easier to understand.


Edited by LiveForIt on 2014/2/25 15:33:34
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@abalaban


yes the ISocket Interface is created, in the main program, but then, the thread does Obtain() the ISocket before use.

int32 ThreadStart_process(STRPTR argsint32 length,APTR execbase)
    {
        
Thread *self;
        
Timer time;
        
int cnt 0;
        
int Seconds 0;

        
sscanf(args"%08x", &self);

        if (
ISocketISocket -> Obtain();

        
self -> _ThreadStart -> func();

        if (
ISocketISocket -> Release();

        
self -> IsAlive false;
    }

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@LiveForIt

Quote:

as you see in "my Code" he Socket is created at frist line before connecting, it is not shared.


bsdsocket.library must be opened seperatly for each process. So even if your socket isn't shared your libraray base and interface is and mustn't be.




Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
Quote:

yes the ISocket Interface is created, in the main program, but then, the thread does Obtain() the ISocket before use.


No you need to open bsdsocket.library and GetInterface() in each thread. Except for rare exceptions Obtain() and Release() are called internally by GetInterface() and DropInteface() they shouldn't be called by program code.



Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@broadblues

It's working now thanks everyone.

Problem where solved by moving OpenLibrary() and GetInterface() into class Socket.

Now there are some problems but I think this are of my own making, Excellent.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Just can't stay away
Just can't stay away


See User information
@broadblues

Quote:
No you need to open bsdsocket.library and GetInterface() in each thread. Except for rare exceptions Obtain() and Release() are called internally by GetInterface() and DropInteface() they shouldn't be called by program code.
You can call Obtain()/Release() directly, see exec GetInterface() autodoc for an example with threads.

Even if RoadShow would store it's per process data in ISocket instead of SocketBase, which isn't the case, using ISocket->Obtain() wouldn't have worked since that just increases the usage count.
For libraries with per process data in the interface you have to use something like thread_IFoobar = global_IFoobar->Clone() instead.

Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@abalaban

Quote:
and even then remember sockets are *not* shareable across processes by default, you'll need to either write a socket server either enable the sharing functionnality in bsdsocket (see Autodocs). Also remember that each process *must* open/close its own libraries/interfaces.


Thank you, the sharing functionality was not clear from reading the Autodocs but I figured it out in the end. The problem whit Autodocs here was that did not explain, that I need bout command, and it did not explain where to use what command.

It was a bit of try and fail, and try again, and then it worked.

As the socket object, has to have the right interfaces, so functions can be called from the object, I created method to set it. This was the perfect place to hide orbiting the socket.

When my Ami C++ Class Framework is ready it will be shared, the Framework will make it easier to port code between AmigaOS and Windows for cross platform applications.


Edited by LiveForIt on 2014/3/3 16:21:13
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@LiveForIt

Quote:

Thank you, the sharing functionality was not clear from reading the Autodocs but I figured it out in the end. The problem whit Autodocs here was that did not explain, that I need bout command, and it did not explain where to use what command.


It's explained in OpenLibrary() and SocketBaseTags()



Go to top
Re: IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@broadblues

I used RelaseCopySocket() and ObtainSocket(), this worked whit some hazel.

This what I found other people where using when googling around.

Is there some working example of how to use SocketBaseTags(), it looks like a bit of a monster, and I'm a slow reader.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Solved; IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
I'm really not sure you should those two functions as they seem to make the sockets public. That could result in another program using your socket! (unless I missunderstand the meaning of public in this context).

I'm not 100% of the usage of SocketbaseTags() in this cobnteaxt as I only ever worked with the open SocketBase for each process approach (which is the recomended approach) but I think you'd open the library and then call

ISocket->SocketBaseTags(SBTM_SETVAL(SBTC_CAN_SHARE_LIBRARY_BASES),1L,TAG_END);

before using the socket API.




Go to top
Re: Solved; IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@broadblues

Quote:
I'm really not sure you should those two functions as they seem to make the sockets public. That could result in another program using your socket! (unless I misunderstand the meaning of public in this context).


yes they become public, and gets a unique id, unless there are other programs that know about uniqueid they can not obtain it.

For a process to use a File Descriptor it has to be in the Process File Descriptor list, so before its obtained no one can use it.

This how I understand how it works.

Quote:
ISocket->SocketBaseTags(SBTM_SETVAL(SBTC_CAN_SHARE_LIBRARY_BASES),1L,TAG_END);


That will most likely only solve Library base / interface problem.
But as File Descriptor as liked to one process or the other, it probeable want solve that issue.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Solved; IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@LiveForIt

Sorry you slightly confused me (maybe more than slightly :-0)
we were talking about Sockets? Where did the file descriptors come from? File descriptors and sockets are not related unless you live in the loonixverse.

What kind of file descriptor? DOS? Unless I'm mistaken you can write a DOS filehandle from any process. Or newlib ? In that case you must make sure all subprocesses are started with NP_Child, then you can share them.



Go to top
Re: Solved; IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@broadblues

its in the name socketfd = socket file descriptor.
it's inheritance a socket, really is file descriptor, but you don't think about it that way.

(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Solved; IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Just can't stay away
Just can't stay away


See User information
@LiveForIt

Quote:
its in the name socketfd = socket file descriptor.
it's inheritance a socket, really is file descriptor, but you don't think about it that way.
The bsdsocket.library sockets aren't stored in a process specific structure but in the SocketBase, but you can't use them from a process other than the one which called IExec->OpenLibrary("bsdsocket.library", ...), unless you enable SocketBase sharing with SBTC_CAN_SHARE_LIBRARY_BASES.

Go to top
Re: Solved; IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Home away from home
Home away from home


See User information
@joerg

Well maybe but look at this error:

EMFILE
The per-process descriptor table is full.

To me it sound like its process file table, and its says porcess.
you know the ins and outs, I know what I read.

So is the documentation wrong?

There is also number of references to fd (file descriptor), not sd (socket descriptor), in the autodocs. Maybe I live in the loonixverse, but I know who put me there.

bsdsocket.library/ObtainSocket                 bsdsocket.library/ObtainSocket

   NAME
    ObtainSocket 
acquire a socket from the public list

   
SYNOPSIS
    socket 
ObtainSocket(iddomaintypeprotocol)
      
D0                  D0     D1    D2      D3

    long ObtainSocket
(long idlong domainlong typelong protocol);

   FUNCTION
    
This function is for passing control of a socket from one process
    to another
The socket to be handed over must be identified by
    an ID
a domaintype and protocol number.

   
RESULT
    A 
-1 is returned if an error occursotherwise the return value is a
    descriptor referencing the socket
.

   
ERRORS
    The ObtainSocket
() call fails if:

    [
EBADF]
        
No socket with the given Id could be found.

    [
EPROTONOSUPPORT]
        
The protocol type or the specified protocol is not
        supported within this domain
.

    [
EMFILE]
        
The per-process descriptor table is full.

    [
ENFILE]
        
The system file table is full.

    [
EACCESS]
        
Permission to create a socket of the specified type
        
and/or protocol is denied.

    [
ENOBUFS]
        
Insufficient buffer space is available.  The socket
        cannot be created until sufficient resources are
        freed
.

   
SEE ALSO
    socket
(), accept(),  bind(),  connect(),  getsockname(),
    
getsockopt(),  IoctlSocket(),  listen(),  recv(),  WaitSelect(),
    
send(),  shutdown(), ReleaseSocket()


Edited by LiveForIt on 2014/3/3 18:26:54
(NutsAboutAmiga)

Basilisk II for AmigaOS4
AmigaInputAnywhere
Excalibur
and other tools and apps.
Go to top
Re: Solved; IScoket->Connect(...) not working from proc = IDOS->CreateNewProcTags(...)
Just can't stay away
Just can't stay away


See User information
@LiveForIt

Quote:
So is the documentation wrong?
Partially, it seems it just wasn't updated when SocketBase sharing was added, before it was added to RoadShow each process had to open it's own SocketBase and the only way to use sockets in different processes was to move a socket from one SocketBase to another one using ReleaseSocket() (removes it from the SocketBase used by the current process, usually the parent process) + ObtainSocket() (adds it to the SocketBase used by the current process, usually a child process of the one which released the socket).

Quote:
There is also number of references to fd (file descriptor), not sd (socket descriptor), in the autodocs.
Some of the docs were probably taken directly from the docs of the BSD4.3 TCP/IP stack on which RoadShow is based without changes, on Unix (and in the AmigaOS C library functions) there is no difference between file and socket descriptors.
The error defines can't be changed, for example from EMFILE to EMSOCKET, or it would be incompatible to other systems.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project