locked
Want to connect to IP :port and read data from connected IP using c# RRS feed

  • Question

  • User-1100884601 posted

    Hi

    I want to write program to connect to IP on specific port and read data .  i have old code which is working fine but i want to rewrite in c#.

    old code:

    LET tmpCH=HFN
     LET openOK=isFALSE
     OPEN (tmpCH,TIM=5,ERR=*NEXT)"[TCP]xx.xx.xx.xxx;8000"; LET openOK=isTRUE
     IF openOK THEN {
     WRITE (tmpCH)"P"
     LET wt$=$$
     READ (tmpCH,TIM=5,ERR=*NEXT)wt$
     LET wt$=SUB(wt$,$0D$,"")
     LET wt$=SUB(wt$,$0A$,"")
     IF wt$<>$$ THEN {
     LET sod.UDF_Scale_Weight=NUM(wt$,ERR=*NEXT)

    Any code reference help will be  helpful for me. 

    Monday, April 20, 2020 7:58 PM

All replies

  • User475983607 posted

    Hi

    I want to write program to connect to IP on specific port and read data .  i have old code which is working fine but i want to rewrite in c#.

    old code:

    LET tmpCH=HFN
     LET openOK=isFALSE
     OPEN (tmpCH,TIM=5,ERR=*NEXT)"[TCP]xx.xx.xx.xxx;8000"; LET openOK=isTRUE
     IF openOK THEN {
     WRITE (tmpCH)"P"
     LET wt$=$$
     READ (tmpCH,TIM=5,ERR=*NEXT)wt$
     LET wt$=SUB(wt$,$0D$,"")
     LET wt$=SUB(wt$,$0A$,"")
     IF wt$<>$$ THEN {
     LET sod.UDF_Scale_Weight=NUM(wt$,ERR=*NEXT)

    Any code reference help will be  helpful for me. 

    Use Sockets.

    https://docs.microsoft.com/en-us/dotnet/framework/network-programming/socket-code-examples

    Monday, April 20, 2020 8:10 PM