How do you translate this to VB.net? I don't know what to do with 'SocketAdress'
Thanks - public static void main(String args[])
-
{
-
-
try {
-
ipAddress = InetAddress.getByName(ipAdressString);
-
} catch (UnknownHostException e) {System.out.println("error: cannot find valid ip address");
-
}
-
-
Port = 12203;
-
socketAddress = new InetSocketAddress(ipAddress, mohserverPort);
-
-
startCommunication();
-
}
15 2180
How do you translate this to VB.net? I don't know what to do with 'SocketAdress'
Thanks - public static void main(String args[])
-
{
-
-
try {
-
ipAddress = InetAddress.getByName(ipAdressString);
-
} catch (UnknownHostException e) {System.out.println("error: cannot find valid ip address");
-
}
-
-
Port = 12203;
-
socketAddress = new InetSocketAddress(ipAddress, mohserverPort);
-
-
startCommunication();
-
}
It looks like socketAddress is declared elswhere in the program. If you are using Visual Studio, right click it and click "Go To Definition." That'll take you to where it is declared.
That's simply a SocketAdress...The code is java. I'd like to know how to make thesame thing in vb.net -
-
static private SocketAddress socketAddress;
-
-
public static void main(String args[])
-
{
-
-
try {
-
ipAddress = InetAddress.getByName(ipAdressString);
-
} catch (UnknownHostException e) {System.out.println("error: cannot find valid ip address");
-
}
-
-
Port = 12203;
-
socketAddress = new InetSocketAddress(ipAddress, mohserverPort);
-
-
startCommunication();
-
}
Plater 7,872
Recognized Expert Expert
Try the System.Net.Dns, System.Net.IPAddress or System.Net.IPEndPoint classes.
Although I wouldn't base anything off that code, it looks to be rather poorly constructed. If the ipaddress triggers that exception, it continues to try and use it regardless.
That's simply a SocketAdress...The code is java. I'd like to know how to make thesame thing in vb.net
Sorry for the misunderstanding. I thought you were trying to port existing code that you were unfamiliar with. Sorry I couldn't help.
That IpEndPoint seems to do the trick.
how about java's DatagramPacket ? Is there a VB.net equivalent?
Plater 7,872
Recognized Expert Expert
Just create and use a socket set for UDP
Just create and use a socket set for UDP
Yes, ok, but the datagrampacket....is there a equivalent in vb.net? cause usage of that datagrampacket seems to be quite essential in the java program
Plater 7,872
Recognized Expert Expert
Everything is sent as bytes, just convert the datagrampacket to a byte[] and you'll have no problem
Look at the UdpClient class.
I'll do that, thanx for the info
Maybe this is a stupid question, but I have never worked with bytes before.
how do you write this in Vb.net?
Java:
Byte oob = (Byte)0xff
Plater 7,872
Recognized Expert Expert
Well that would work in C#, in vb.net the syntax is different.
(Going from java to c# woulda been easier as the syntax is very similar)
I think it's like BigDaddyLH 1,216
Recognized Expert Top Contributor
Well that would work in C#, in vb.net the syntax is different.
(Going from java to c# woulda been easier as the syntax is very similar)
I think it's like
could you explain the conversion from 0xff to &HFF for me please?
could you explain the conversion from 0xff to &HFF for me please?
Didn't the & stand for adress of, or is &H just the leading code for a byte?
Plater 7,872
Recognized Expert Expert
&H in VB must be the same as 0x in all the other languages.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Davis Marques |
last post by:
hi;
I'm translating some PHP scripts to Python and have hit a roadblock
with a for statement. If someone could explain to me how one should
translate the multiple increment, evaluations, etc....
|
by: Henrik S. Hansen |
last post by:
How do you best go about translating characters like '\\n' to '\n'?
This is for a configuration file parser, where the "backslash
convention" is supported.
The naive approach --...
|
by: Michael Friendly |
last post by:
I have a LaTeX document describing a long list of items that I want to
translate to XML to treat these as a database. I've written a perl
script to do the basic translation, and a basic DTD file,...
|
by: Charles Law |
last post by:
Hi guys
A bit of curve ball here ... I have a document (Word) that contains a series
of instructions in sections and subsections (and sub-subsections). There are
350 pages of them.
I need to...
|
by: gregf |
last post by:
I have a paragraph of text pasted into a word document, it's in Polish,
complete with polish characters. They show up just fine in word, but
the program I use for web page programming, HomeSite,...
| |
by: Dylan Phillips |
last post by:
I'm interested in how other participants in this new group are implementing
SQL Full-Text Search on their Web Sites.
How are you translating the user search string: "DirectX managed code" into...
|
by: J |
last post by:
Hi all,
I just finished a asp.net project, which is based on English language, and all
of sudden, client need different language also, say German, Chinese, etc. So,
what is the best way, or I...
|
by: Jumping Matt Flash |
last post by:
The code i'm writing is using VB .NET and is for a web service returning a
dataset, which is in turn to be used by an ASP .NET application displaying a
datagrid.
I'm currently populating a...
|
by: kimi |
last post by:
Voip Learning and Translating Tutorial
Voice Over IP is a new communication means that let you telephone with
Internet at almost null cost.
How this is possible, what systems are used, what is the...
|
by: timn |
last post by:
Translating Access SQL queries into SQL subqueries.
--------------------------------------------------------------------------------
I have a query in Access that uses a subquery, I would like...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |