|
I think I figured it out......I just need to use this -
eval sin_addr = inet_addr('aa.aa.aa.aa')
Thanks for everyone's assistance.
Joe
Joe Wells
University of Alabama Health Services Foundation
500 22nd Street South, Suite 308
Birmingham, AL 35233
205-731-5610
CONFIDENTIALITY NOTICE
This e-mail is intended for the sole use of the individual(s) to whom it is
addressed, and may contain information that is privileged, confidential and
exempt from disclosure under applicable law. You are hereby notified that
any dissemination, duplication or distribution of this transmission by
someone other than the intended addressee or its designated agent is
strictly prohibited. If you receive this e-mail in error, please notify me
immediately by replying to this e-mail.
JoeOn 9/30/2009 at 10:44 AM, in message <4AC33694.9C78.0031.0@xxxxxxxxx>,
Wells<jwells@xxxxxxxxx> wrote:
Apologies in advance for what may turn into a rambling email......
OK, to better explain the situation - Our 400 has two ip addresses -
aa.aa.aa.aa and bb.bb.bb.bbb.
The server program uses bind() and specifies a local port.
When the program is running, netstat shows the local ip as aa.aa.aa.aa .
This works fine (at the moment).
The client program specifies an ip address and port for the host.
When first written several weeks ago, this program worked fine.
While testing yesterday, the connection timed out.
Netstat showed that the local ip was bb.bb.bb.bbb. This is why it would
not
connect.
I tried again this morning and it used aa.aa.aa.aa and it ran fine.
I will try to get the hospital network folks to open up bb.bb.bb.bbb
like
aa.aa.aa.aa, but in the interim, I would like to force the client
program to
use aa.aa.aa.aa as the local ip. Let me mention that we are part of the
university hospital system and we are communicating with an affiliated
hospital. The affiliated hospital is outside of the university
hospital's
firewall. So, the university hosptal network guys configured a tunnel
(not
sure if this is the correct word) that only allows traffic from our ip
address (aa.aa.aa.aa) to a specific port on the affiliated hospital's ip
address. And likewise, only traffic from the affiliated hospital's ip
address to a specific port on our ip address (aa.aa.aa.aa). Hopefully
this
adequately (and correctly) explains the situation.
In theory, I understand what Michael is suggesting. Unfortunately, I am
new
to sockets and am struggling with how/where to specify the ip address.
The
bind() that is called in the server program does not specify an ip, only
a
port.
Any help, tips, suggestions, or examples would be most appreciated.
Thanks,
Joe
Joe Wells
University of Alabama Health Services Foundation
500 22nd Street South, Suite 308
Birmingham, AL 35233
205-731-5610
CONFIDENTIALITY NOTICE
This e-mail is intended for the sole use of the individual(s) to whom it
is
addressed, and may contain information that is privileged, confidential
and
exempt from disclosure under applicable law. You are hereby notified
that
any dissemination, duplication or distribution of this transmission by
someone other than the intended addressee or its designated agent is
strictly prohibited. If you receive this e-mail in error, please notify
me
immediately by replying to this e-mail.
<4AC2C45F.8040902@xxxxxxxxxxxxxxxx>,On 9/29/2009 at 9:37 PM, in message
Scott Klement<rpg400-l@xxxxxxxxxxxxxxxx> wrote:
The bind() API can be used to force a TCP socket to use a particular IP
address, as Michael already explained. Set the port to 0 to let the OS
choose the port.
However, this doesn't make sense to do. IF your TCP/IP routes are
configured properly, it will automatically pick the correct IP address.
If the routes aren't configured properly, binding to a particular
address won't help you, because the packets still need to be routed
correctly for the connection to work.
So this doesn't make a lot of sense to me.
Binding to a particular IP address is a tool usually used on a listening
it
server program so that you can (for example) listen on your internal
subnet without allowing access from the public internet. Stuff like
that. It doesn't make sense to use in a client program -- at least not
in my experience.
I wonder if you don't have a misconfigured route somewhere?
Joe Wells wrote:
Our 400 has two IP addresses.of my
Using Scott Klement's socket utilities service program, I have created
working client and server programs.
Here is my dilemma - our network folks established a secure connection
(tunnel?) between us and another system. The problem is that the one
socket programs is now using the "other" ip address on our 400.the
Consequently, this program cannot connect!
So, my question is - Is there a way to specify the outbound IP address
socket uses?
Thanks,
Joe
Joe Wells
University of Alabama Health Services Foundation
500 22nd Street South, Suite 308
Birmingham, AL 35233
205-731-5610
CONFIDENTIALITY NOTICE
This e-mail is intended for the sole use of the individual(s) to whom
is
addressed, and may contain information that is privileged, confidential
notifyand
exempt from disclosure under applicable law. You are hereby notifiedthat
any dissemination, duplication or distribution of this transmission by
someone other than the intended addressee or its designated agent is
strictly prohibited. If you receive this e-mail in error, please
me
immediately by replying to this e-mail.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.