× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



What is the relationship between the flags variable and the writeset variable? My code (stripped out) looks like this.
*-- I/O options (Fcntl) ----------------------
*
D F_SETFL S 10I 0 Inz(7)
D O_NONBLOCK S 10I 0 Inz(128)

*-- FCntl --- File control for I/O
*
* int fcntl(int file_descriptor, int cmd, . . .);
*
D FCntl Pr 10I 0 Extproc('fcntl')
*
D 10I 0 Value
D F_SETFL 10I 0 Value
D O_NONBLOCK 10I 0 Value Options(*Nopass)


* Obtain a socket descriptor
c Eval Sd = socket(af_inet: sock_str: 0)
* Connect to the server
c Eval Rc = connect( sd:
C %Addr(SocketAddr):
C %Size(SocketAddr))
* Set nonblocked mode for the socket
c Eval Rc = fcntl(sd: f_setfl: o_nonblock)

-----Original Message-----
From: MIDRANGE-L [mailto:midrange-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of a4g atl
Sent: Monday, March 04, 2019 11:30 AM
To: Midrange Systems Technical Discussion
Subject: Re: Example socket program to send data to a non IBM i device

I finally got the code from the older hardware. I still have the long timeout. I am posting the code for review.

Thanks

Darryl Freinkel.

C*************************************************
C* Create a socket
C*************************************************
c eval sock = socket(AF_INET: SOCK_STREAM:
c IPPROTO_IP)
c if sock < 0
c eval msg = 'Error calling socket()!'
c dsply msg
c return
c endif

C*************************************************
C* Create a socket address structure that
C* describes the host & port we wanted to
C* connect to
C*************************************************
c eval addrlen = %size(sockaddr)
c alloc addrlen p_connto

c eval p_sockaddr = p_connto
c eval sin_family = AF_INET
c eval sin_addr = IP_address
c eval sin_port = port
c eval sin_zero = *ALLx'00'

c eval flags = fcntl(sock: F_GETFL)
c if flags < 0
c eval flags = flags
debug
c Endif

c* callp FD_ZERO(writeset)

c* eval flags = flags + O_NONBLOCK
c eval flags = %bitor(flags : O_NONBLOCK)

c callp FD_SET(sock : writeset)

c select
c when rc = -1
c exsr error_message
c callp close(sock)
c return
c Endsl

C*************************************************
C* Connect to the requested host
C*************************************************
C if connect(sock: p_connto: addrlen) < 0
c eval msg = 'unable to connect to server!'
c* dsply msg
c exsr error_message


On Thu, Feb 28, 2019 at 5:21 PM a4g atl <a4ginatl2@xxxxxxxxx> wrote:

Scott

Apologies for the delay in responding. The system I developed the code
on was the old hardware and to my surprise it was decommissioned with
the admins checking with me. I am waiting for the Library to be
restored so that I can be more specific with what I tested. I do
remember trying the non blocking option too but will confirm tomorrow I hope.

@Richard, unfortunately I am not a .net person.

I will look at Python as it will run on the IBMi, but everyone would
prefer the RPG option.

Thanks

On Thu, Feb 28, 2019 at 8:53 AM Richard Schoen via MIDRANGE-L <
midrange-l@xxxxxxxxxxxxxxxxxx> wrote:

I haven't been following this thread closely, but I have a thought
for you.

You should be able to create a VB.Net or C# app that connects to the
device.

Once you test it on the PC in Visual Studio you can move the EXE over
to IBMi using the new Mono .Net functionality.

You'll probably more readily find .Net examples than RPG ones.

Food for thought.......

Regards,
Richard Schoen
Director of Document Management
e. richard.schoen@xxxxxxxxxxxxxxx
p. 952.486.6802
w. helpsystems.com
------------------------------

message: 2
date: Wed, 27 Feb 2019 17:50:48 -0500
from: a4g atl <a4ginatl2@xxxxxxxxx>
subject: Re: Example socket program to send data to a non IBM i
device

The problem is

If the device is online,
- I can connect to the device. The socket() is successful.
- If the device is on line but the port is not in listen mode, the
program goes into a wait/retry mode at the connect(). This takes 3.5
minutes before returning control to the RPG program.

I tried adding the setsock() functions and trying that, but it would
not change the situation.

Darryl.






--
This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com



CONFIDENTIALITY NOTICE

This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.