FPC Sockets documentation? 
Author Message
 FPC Sockets documentation?

Any good examples/documentation floating around?

Thanks



Mon, 28 Apr 2003 03:00:00 GMT  
 FPC Sockets documentation?

Quote:

> Any good examples/documentation floating around?

Which target (OS?) For Linux/FreeBSD I have some mini chatserver lying
around somewhere. Only the telnet emulation is too simple, and the M$
windows telnet client doesn't work with it.

P.s. afaik there is also documentation for Sockets in  the "Units" part
of the manual

--




Tue, 29 Apr 2003 07:44:33 GMT  
 FPC Sockets documentation?

Quote:

> Any good examples/documentation floating around?

The sockets unit is completely documented. Have a look at the "Standard
units reference manual" part of the manual.

Jonas



Tue, 29 Apr 2003 03:00:00 GMT  
 FPC Sockets documentation?
Quote:


> > Any good examples/documentation floating around?

> The sockets unit is completely documented. Have a look at the "Standard
> units reference manual" part of the manual.

> Jonas

I'm writing for Windows 95.

The documentation online seems a little..strange.  Repeated four times or
something.  Anyway, the PDF has a little more detail that I can follow.

What I'm really missing is how to set the IP address correctly.  From the
sample code:
{ localhost : 127.0.0.1 in network order }
Addr.Addr:=((1 shl 24) or 127);

How about 145.89.45.1?
Addr.Addr:=((1 shl 24) and (45 shl 16) and (89 shl 8) or 145); ???

Thanks,
Eric



Tue, 29 Apr 2003 03:00:00 GMT  
 FPC Sockets documentation?

Quote:
> What I'm really missing is how to set the IP address correctly.  From the
> sample code:
> { localhost : 127.0.0.1 in network order }
> Addr.Addr:=((1 shl 24) or 127);

> How about 145.89.45.1?
> Addr.Addr:=((1 shl 24) and (45 shl 16) and (89 shl 8) or 145); ???

I don't know about TCP/IP etc., but a little boolean algebra or something
like that. Use Addr.Addr:=((1 shl 24) or (45 shl 16) or (89 shl 8) or 145);
to set the bytevalues 145, 89, 45 and 1 in a 4-byte variable (the leftmost
byte will be 1, the rightmost 145). Thus or instead of and.

{10010001 is the binary equivalent of 145
01011001 is the binary equivalent of 89
00101101 is the binary equivalent of 45
00000001 is the binary equivalent of 1

(1 shl 24) equals 00000001 00000000 00000000 00000000
(45 shl 16) equals 00000000 00101101 00000000 00000000
(89 shl 8) equals 000000000 00000000 1011001 00000000
145 equals 00000000 00000000 00000000 10010001

or-ing these values (value1 or value2 or value3 or value4) will result in
00000001 00101101 01011001 10010001, exactly what you wanted to have! Or
returns 1 if _any_ value is 1, And returns 1 only if _all_ values are one}

KuifWare,
http://kuifware.freeservers.com



Tue, 29 Apr 2003 03:00:00 GMT  
 FPC Sockets documentation?

Quote:

> > What I'm really missing is how to set the IP address correctly.  From the
> > sample code:
> > { localhost : 127.0.0.1 in network order }
> > Addr.Addr:=((1 shl 24) or 127);

> > How about 145.89.45.1?
> > Addr.Addr:=((1 shl 24) and (45 shl 16) and (89 shl 8) or 145); ???

> I don't know about TCP/IP etc., but a little boolean algebra or something
> like that. Use Addr.Addr:=((1 shl 24) or (45 shl 16) or (89 shl 8) or 145);
> to set the bytevalues 145, 89, 45 and 1 in a 4-byte variable (the leftmost
> byte will be 1, the rightmost 145). Thus or instead of and.

> {10010001 is the binary equivalent of 145
> 01011001 is the binary equivalent of 89
> 00101101 is the binary equivalent of 45
> 00000001 is the binary equivalent of 1

> (1 shl 24) equals 00000001 00000000 00000000 00000000
> (45 shl 16) equals 00000000 00101101 00000000 00000000
> (89 shl 8) equals 000000000 00000000 1011001 00000000
> 145 equals 00000000 00000000 00000000 10010001

> or-ing these values (value1 or value2 or value3 or value4) will result in
> 00000001 00101101 01011001 10010001, exactly what you wanted to have! Or
> returns 1 if _any_ value is 1, And returns 1 only if _all_ values are one}

> KuifWare,
> http://kuifware.freeservers.com

Excellent.  Now that I have something running, where can I find the SYS_xxx
errors that are supposed to be returned from all the socket processes?  It's
not in sockets.pp, winsock.pp, socketsh.inc, or errors.inc, or anywhere that
I've looked anyway...


Tue, 29 Apr 2003 03:00:00 GMT  
 FPC Sockets documentation?

Quote:


> > > What I'm really missing is how to set the IP address correctly.  From the
> > > sample code:
> > > { localhost : 127.0.0.1 in network order }
> > > Addr.Addr:=((1 shl 24) or 127);

> > > How about 145.89.45.1?
> > > Addr.Addr:=((1 shl 24) and (45 shl 16) and (89 shl 8) or 145); ???

> > I don't know about TCP/IP etc., but a little boolean algebra or something
> > like that. Use Addr.Addr:=((1 shl 24) or (45 shl 16) or (89 shl 8) or 145);
> > to set the bytevalues 145, 89, 45 and 1 in a 4-byte variable (the leftmost
> > byte will be 1, the rightmost 145). Thus or instead of and.

> > {10010001 is the binary equivalent of 145
> > 01011001 is the binary equivalent of 89
> > 00101101 is the binary equivalent of 45
> > 00000001 is the binary equivalent of 1

> > (1 shl 24) equals 00000001 00000000 00000000 00000000
> > (45 shl 16) equals 00000000 00101101 00000000 00000000
> > (89 shl 8) equals 000000000 00000000 1011001 00000000
> > 145 equals 00000000 00000000 00000000 10010001

> > or-ing these values (value1 or value2 or value3 or value4) will result in
> > 00000001 00101101 01011001 10010001, exactly what you wanted to have! Or
> > returns 1 if _any_ value is 1, And returns 1 only if _all_ values are one}

> > KuifWare,
> > http://kuifware.freeservers.com

> Excellent.  Now that I have something running, where can I find the SYS_xxx
> errors that are supposed to be returned from all the socket processes?  It's
> not in sockets.pp, winsock.pp, socketsh.inc, or errors.inc, or anywhere that
> I've looked anyway...

ok, I've got a good idea they're in errno.inc, of course they seem to be unix
system specific.  If I've got an error code from SocketError and it's value is
10043, where do I look that up?  No doubt some arcane Microshaft TCP/IP
programming guide.


Tue, 29 Apr 2003 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Wanted: Documentation on sockets / database programming

2. FPC - Socket Problem

3. FPC Client with sockets unit

4. FPC Listening with Sockets unit

5. FPC Socket debuging

6. More Sockets in FPC

7. FPC: runtime error 215 - lack in documentation....

8. documentation FPC-unit <windows>?

9. FPC: Documentation on Win32 units?

10. FPC:problem with printing from fpc programs

11. FPC: translate execvp from c to FPC

12. Communication from Socket Server to Client.

 

 
Powered by phpBB® Forum Software