Can anyone help?
I have a dll that establishes a pipe that will obtain data from another program. Currently it is setup to continually listen for new data and then get itfrom another program.
Is it possible upon the call to the dll to create the pipe connection, get the data, and close each time? It would essentially be getting rid of the do while loop. The call to the dll to get the data could occur once every second.
If the below code is not the best route to do this would TransactNamedPipe be better? Or are there other suggestions?
Thanks
pipe = CreateFile( "\\\\.\\pipe\\ssguipipe"C, &
IOR(GENERIC_WRITE , GENERIC_READ) , &
IOR(FILE_SHARE_READ , FILE_SHARE_WRITE), &
NULL_SECURITY_ATTRIBUTES, &
OPEN_EXISTING, &
FILE_FLAG_OVERLAPPED, &
DEFAULT )
do while(.TRUE.)
if(ReadFile(pipe,LOC(pipebuf),1024 ,LOC(inlen),NULL_OVERLAPPED).eqv. .TRUE.)then
!write(*,*)'so far so good'
firstpos = SCAN(pipebuf,'@')
lastpos = SCAN(pipebuf,'$')
!write(*,*)pipebuf(firstpos+1:lastpos-1)
read(pipebuf(firstpos+1:lastpos-1),*)Dat1(1),Dat1(2),Dat1(3),Dat1(4),Dat1(5),Dat1(6),Dat1(7),Dat1(8),Dat1(9),Dat1(10),Dat1(11),Dat1(12)
else
write(*,*)'disconnected'
stop
end if
end do
I have a dll that establishes a pipe that will obtain data from another program. Currently it is setup to continually listen for new data and then get itfrom another program.
Is it possible upon the call to the dll to create the pipe connection, get the data, and close each time? It would essentially be getting rid of the do while loop. The call to the dll to get the data could occur once every second.
If the below code is not the best route to do this would TransactNamedPipe be better? Or are there other suggestions?
Thanks
pipe = CreateFile( "\\\\.\\pipe\\ssguipipe"C, &
IOR(GENERIC_WRITE , GENERIC_READ) , &
IOR(FILE_SHARE_READ , FILE_SHARE_WRITE), &
NULL_SECURITY_ATTRIBUTES, &
OPEN_EXISTING, &
FILE_FLAG_OVERLAPPED, &
DEFAULT )
do while(.TRUE.)
if(ReadFile(pipe,LOC(pipebuf),1024 ,LOC(inlen),NULL_OVERLAPPED).eqv. .TRUE.)then
!write(*,*)'so far so good'
firstpos = SCAN(pipebuf,'@')
lastpos = SCAN(pipebuf,'$')
!write(*,*)pipebuf(firstpos+1:lastpos-1)
read(pipebuf(firstpos+1:lastpos-1),*)Dat1(1),Dat1(2),Dat1(3),Dat1(4),Dat1(5),Dat1(6),Dat1(7),Dat1(8),Dat1(9),Dat1(10),Dat1(11),Dat1(12)
else
write(*,*)'disconnected'
stop
end if
end do