허당 레몬도리
www.bea.com 사이트에서 턱시도와 Visual Studio 2005를 이용해 클라이언트를 개발할 수 있는 턱시도 클라이언트(tuxedo100_32_win_2k3_x86_VS2005.exe)를 받아 full Client로 설치하고 프로젝트에 libwscdnet.dll를 참조추가 한다 C#
  
public static class TuxedoInterface
    {
        private static int notify_Count;
        private static string[] notify_String = new string[10];
        /// 
        /// Notify 데이터 
        /// 
        public static string[] Notify_String
        {
            get { return TuxedoInterface.notify_String; }
            set { TuxedoInterface.notify_String = value; }
        }

        internal static Boolean Tuxedo_TP_CALL(string send_TranCode, string recv_TranCode)
        {
            notify_Count = 0;

            //송신내용
            TypedString send_String = new TypedString(70000);

            //수신내용
            TypedCArray recv_String = new TypedCArray(70000);
            //접속할 서버
            Utils.tuxputenv("WSNADDR=//" + Common.Connect_Server_IP + ":" + Common.Connect_Server_PORT);

            TypedTPINIT tpinit = new TypedTPINIT();

            AppContext appContext = AppContext.tpinit(tpinit);

            long a = 2;
            appContext.tpsetunsol(new UnsolicitedMessageHandler(MessageHandeler));
            send_String.PutString(0, send_TranCode, send_TranCode.Length);
            try
            {
                TypedBuffer buffer = (TypedBuffer)recv_String;
                appContext.tpcall("BNCSIN", (TypedBuffer)send_String, ref buffer, a);
                IntPtr address = (IntPtr)recv_String.Buffer.ToInt64();
                recv_TranCode = Marshal.PtrToStringAnsi(address);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "TPFAIL");
                return false;
            }

            appContext.tpterm();
            
            return true;
        }

        internal static void MessageHandeler(AppContext appContext, TypedBuffer typeBuffer, long flages)
        {
            IntPtr intPtr = (IntPtr)typeBuffer.Buffer.ToInt64();

            string recv_String = Marshal.PtrToStringAnsi(intPtr);

            notify_Count = notify_Count + 1;

            notify_String[notify_Count - 1] = recv_String;
        }
    }
VB
  
    Public NotifyCnt As Integer
    Public NotifyString(10) As String

    Public Function TuxTpcall(ByVal SendStr As String, ByRef RecvStr As String) As Boolean

        NotifyCnt = 0

        ' 송신내용
        Dim sndstr As New TypedString(70000)

        ' 수신내용
        Dim rcvstr As New TypedCArray(70000)

        ' 접속서버 환경설정
        Utils.tuxputenv("WSNADDR=//" + 서버아이피 + ":" + 서버포트번호)

        ' TPINIT
        Dim tpinfo As New TypedTPINIT()

        Dim ac As AppContext = AppContext.tpinit(tpinfo)

        ac.tpsetunsol(New UnsolicitedMessageHandler(AddressOf MyUMHandler))

        sndstr.PutString(0, SendStr, SendStr.Length)
        Try
            ac.tpcall("BNCSIN", sndstr, rcvstr, 2)
            Dim Addr As IntPtr = rcvstr.Buffer.ToInt64()
            RecvStr = Marshal.PtrToStringAnsi(Addr)   '73680
        Catch ex As Exception
            MessageBox.Show(ex.Message, "TPFAIL")
            Return False
        End Try

        ac.tpterm()

        Return True

    End Function

    Public Function MyUMHandler(ByVal appctxt As AppContext, ByVal tb As TypedBuffer, ByVal flags As Long)

        Dim Addr As IntPtr = tb.Buffer.ToInt64()

        Dim RecvStr As String = Marshal.PtrToStringAnsi(Addr)

        NotifyCnt = NotifyCnt + 1

        NotifyString(NotifyCnt - 1) = RecvStr

        Return 0

    End Function

위와 같이 작성후 서비스 원하는 값을 전송하여 원하는 값을 받을수 있다.
profile

허당 레몬도리

@LemonDory

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!