dbTalk Databases Forums  

D3 Sockets %connect() - Help please?

comp.databases.pick comp.databases.pick


Discuss D3 Sockets %connect() - Help please? in the comp.databases.pick forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John
 
Posts: n/a

Default D3 Sockets %connect() - Help please? - 05-26-2005 , 06:51 AM






Hello all.

I'm having a really hard time with D3 sockets.

I cannot get a D3 socket to connect to the outside world. I can get the
outside world to connect to a socket server/listner on my D3/Linux
system but cannot make it work the other way round. I have a short Java
server program listening to port 2002 the D3 machine which gives visual
feedback about incomming connections. I can connect to this Java server
using another Java program - even using an external connection such as
Windows XP Telnet. It is just the D3 program that won't connect. Are
D3/Linux client sockets broken?


Here is the essential code (transcribed):

cfunction socket.builtin
include dm,bp,includes sysid.inc
include dm,bp.unix.h socket.h

SOC.ID = %socket(AF$INET, SOCK$STREAM, 0)
IF SOCK.ID < 0 THEN
... handle error ...
END

PORT = 2002
ERR.FLAG = %connect(SOC.ID, AF$INET, "127.0.0.1", PORT)
IF ERR.FLAG < 0 THEN
CRT 'Unable to establish connection'
END ELSE
CRT 'Got a connection'
END

%close(SOCK.ID)



The issue is not firewalling or ethernet. I can connect to the Java
server (on the localhost) with anything else - just NOT D3.

Thanks in advance.


John Bend.

Reply With Quote
  #2  
Old   
Bob Little
 
Posts: n/a

Default Re: D3 Sockets %connect() - Help please? - 05-26-2005 , 08:16 AM






John wrote:
Quote:
Hello all.

I'm having a really hard time with D3 sockets.

I cannot get a D3 socket to connect to the outside world. I can get the
outside world to connect to a socket server/listner on my D3/Linux
system but cannot make it work the other way round. I have a short Java
server program listening to port 2002 the D3 machine which gives visual
feedback about incomming connections. I can connect to this Java server
using another Java program - even using an external connection such as
Windows XP Telnet. It is just the D3 program that won't connect. Are
D3/Linux client sockets broken?


Here is the essential code (transcribed):

cfunction socket.builtin
include dm,bp,includes sysid.inc
include dm,bp.unix.h socket.h

SOC.ID = %socket(AF$INET, SOCK$STREAM, 0)
IF SOCK.ID < 0 THEN
... handle error ...
END

PORT = 2002
ERR.FLAG = %connect(SOC.ID, AF$INET, "127.0.0.1", PORT)
IF ERR.FLAG < 0 THEN
CRT 'Unable to establish connection'
END ELSE
CRT 'Got a connection'
END

%close(SOCK.ID)



The issue is not firewalling or ethernet. I can connect to the Java
server (on the localhost) with anything else - just NOT D3.

Thanks in advance.


John Bend.
I think I recall reading that the host argument of the %connect function
needs to be a name. I wonder if you susbstitute "localhost" for the IP
address and make sure your hosts file contains that name and it points
to 127.0.0.1.

Its worth a try.

--
Bob Little
Graphik Dimensions, Ltd.
High Point, NC


Reply With Quote
  #3  
Old   
John
 
Posts: n/a

Default Re: D3 Sockets %connect() - Help please? - 05-26-2005 , 10:31 AM



It's OK - problem solved many thanks.

My actual code was allowing PORT to be interpreted as a string rather
than an integer. Meanwhile the port had got stuffed.

Using PORT = PARAM<whatever> + 0 solves the problem.


John Bend.



John wrote:
Quote:
Hello all.

I'm having a really hard time with D3 sockets.

I cannot get a D3 socket to connect to the outside world. I can get the
outside world to connect to a socket server/listner on my D3/Linux
system but cannot make it work the other way round. I have a short Java
server program listening to port 2002 the D3 machine which gives visual
feedback about incomming connections. I can connect to this Java server
using another Java program - even using an external connection such as
Windows XP Telnet. It is just the D3 program that won't connect. Are
D3/Linux client sockets broken?


Here is the essential code (transcribed):

cfunction socket.builtin
include dm,bp,includes sysid.inc
include dm,bp.unix.h socket.h

SOC.ID = %socket(AF$INET, SOCK$STREAM, 0)
IF SOCK.ID < 0 THEN
... handle error ...
END

PORT = 2002
ERR.FLAG = %connect(SOC.ID, AF$INET, "127.0.0.1", PORT)
IF ERR.FLAG < 0 THEN
CRT 'Unable to establish connection'
END ELSE
CRT 'Got a connection'
END

%close(SOCK.ID)



The issue is not firewalling or ethernet. I can connect to the Java
server (on the localhost) with anything else - just NOT D3.

Thanks in advance.


John Bend.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.