Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

WINSOCK WITH POWERCOBOL

Status
Not open for further replies.

veneto

Programmer
Jan 3, 2004
5
IT
I would like use Winsock control with Powercobol. For receive, all ok. But for sending , winsock dont work. With visual basic receive and send work correctly!!!!.
why????

Receive:
01 WCOD PIC X(8).
01 WIP PIC X(50).

INVOKE WINsockIN "GetData" USING WCOD. MOVE "RemoteHostIP" OF WINsockIN TO WIP.

VISUALBASIC:
WsockIN.GetData a, vbString

******************************************************
sending:
01 WCOD PIC X(8).
01 WIP PIC X(50).
01 WR PIC X(50).

IF "STATE" OF WINsockOUT NOT = 0
INVOKE WINsockOUT "CLOSE".
MOVE 1 TO "Protocol" OF WINsockOUT.
MOVE WIP TO "RemoteHost" OF WINsockOUT.
MOVE 4000 TO "RemotePort" OF WINsockOUT.
INVOKE WINsockOUT "SendData" USING by reference WR

VISUALBASIC:
If WsockOUT.State <> sckClosed Then WsockOUT.Close
WsockOUT.Protocol = sckUDPProtocol
WsockOUT.RemoteHost = WsockIN.RemoteHostIP
WsockOUT.RemotePort = 4000
WsockOUT.SendData &quot;RISPOSTA : &quot; & a

******************************************************


 
veneto,

Good luck with this. I had a post out here about 6 weeks ago in the Fujitsu forum (which doesn't seem to exist anymore). I was having much the same problems using the winsock control in PowerCOBOL. Nobody really could help me. The same app written in VB works fine. Fujitsu tech support (which we pay for) acknowledged the problem and blamed the winsock control itself. They offered (for a fee of course) to research it further but I just gave up and wrote the app in VB and called COBOL DLL's to read my files. If you find answer please post it.
 
Hi veneto & kwmjmw,

While the experts here a very good, they don't claim to solve everything thrown at them. Sometimes, with a little patience and an open mind, seemingly untractable problems can be solved.

First off, the problem you are having may or may not be COBOL related.

That said, for starters let's try to apply a COBOL solution. This may or may not work. I don't have the same setup you have. I must trust you to test my suggestions and post the feedback.

Winsock could very well be expecting your buffers to be null terminated. Add LOW-VALUES at the end of the buffer (WIP?) your sending to Winsock.

Try this:

01 WIP.
01 WIP-TEXT PIC X(49).
01 WIP-NULL PIC X VALUE LOW-VALUES.

Dimandja

 
Ciao kwm..., Dimandja
I'resolve the problem creating an new ocx in visual Basic.
This ocx works like the microsoft winsok, but work correctly with powercobol. If you like i can send you my visual basic projext.

My ocx, when receiveng data trasmitt a string and an ID, for sending is enough invoking a method with the string and the ID.

Sorry fo my bad english

By
 
Bravo, veneto.

Are you saying that the acquisition of the ID was the solution?

Dimandja
 
Ciao Dimandja

My ocx when occurs an tcpip event, translate the IP address in a numerical ID for my Powercobol program. My powercobol programm reply at this ID an the OCx translate the ID in IP address.
The ocx had no limit for the number of IP address in the same time.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top