|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Junior Member
Iscritto dal: Dec 2008
Messaggi: 3
|
[java] [vb.net] problemi di conversione
Sto ercando di convertire una classe vb.net in java. Non sono competente in materia, quindi non so se ho convertito correttamente la parte di codice.
Per esempio come si traduce in java l'istruzione vb.net Dim localAddr As IPAddress = IPAddress.Any? Allego parte del sorgente che ho scritto in java e il relativo sorgente in vb.net. Grazie. Stefano --------------------- Sorgente java: Charset charset = Charset.forName("ISO-8859-1"); CharsetDecoder decoder = charset.newDecoder(); CharsetEncoder encoder = charset.newEncoder(); ServerSocket listener = new ServerSocket(0); String szPort = "0 "; Socket client = new Socket(_hostName, _portNum); System.out.println("Tcp_IO 11"); client.setSoTimeout(5000); DataOutputStream nsOut = new DataOutputStream(client.getOutputStream()); DataInputStream nsIn = new DataInputStream(client.getInputStream()); --------------------- Sorgente VB.NET: Dim eb As Encoding = Encoding.GetEncoding("windows-1250") Dim localAddr As IPAddress = IPAddress.Any Dim listener As New TcpListener(localAddr, 0) Dim client As New TcpClient() Dim ns As NetworkStream listener.Start() Dim ipep As IPEndPoint = listener.LocalEndpoint Dim szPort As String = ipep.Port.ToString.PadRight(4, " ") client.SendTimeout = 5000 client.ReceiveTimeout = 5000 client.Connect(hostName, portNum) ns = client.GetStream() Ultima modifica di sfarella : 06-12-2008 alle 07:39. Motivo: Modifica del titolo |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 07:11.