Hi All -
Using Visual Studio 2005 Pro...
I'm going to ask a question about some code I inherited. I'm trying
to learn how it works so please bear with me if my question doesn't
make sense. I have a program that acts as a socket server - a
middleman between a fortran dll and several client apps. Runs fine on
XP. Threw it on a Vista machine the other day and it kept bombing
out.
After a bit of debugging the code on the Vista machine and the XP
machine, I discovered the difference and I seem to have solved my
problem, though I don't really understand it.
This server waits for a connection and then uses asychronous
operations to
accept the connection, get data from the connected client,
performs the requested functions (calls fortran.DLL) and
returns output to the client.
It then disconnects from the client and waits for another client.
----------------------------------------------------------------------------------------------------------------------
Public Shared Sub Main()
'Get port from registry
Dim iPort As Int16 = My.Settings.por t
'Make seperate thread for system tray icon
Dim thrCtl As New BackgroundWorke r
AddHandler thrCtl.DoWork, AddressOf Notify_Handler
thrCtl.RunWorke rAsync()
' Data buffer for incoming data.
Dim bytes() As Byte = New [Byte](1023) {}
' Establish the local endpoint for the socket.
Dim ipHostInfo As IPHostEntry = Dns.GetHostEntr y("localhost" )
Dim ipAddress As IPAddress = ipHostInfo.Addr essList(0)
Dim localEndPoint As New IPEndPoint(ipAd dress, iPort)
' Create a TCP/IP socket.
Dim listener As New Socket(AddressF amily.InterNetw ork,
SocketType.Stre am, ProtocolType.Tc p)
' Bind the socket to the local endpoint and listen for
incoming connections.
listener.Bind(l ocalEndPoint)
listener.Listen (100)
more code
more code
more code
----------------------------------------------------------------------------------------------------------------------
My question refers to the line:
Dim ipAddress As IPAddress = ipHostInfo.Addr essList(0)
In XP, so far as I can tell, the .AddressList returned is always
length = 1 (no matter which machine I run it on), so subscript 0
always contains the information I need to continue. However, on my
Vista machine (one data point, I know, I know), the .AddressList
returned is length = 2, and the subscript 1 contains the information I
need to continue.
So to make this run in Vista I just changed a single character, the
zero to a one, and everything works.
Dim ipAddress As IPAddress = ipHostInfo.Addr essList(1)
So I'm not really even sure what question to ask here. I guess, why
might I get length 1, and when I do, how can I figure out which one
I need? Try a novice in this particular area of VB.NET. MSDN docs
are pretty confusing. I'm not sure if this is even an XP vs Vista
issue, or maybe it's not OS dependent and I'm missing some other key
detail.
Thanks in advance for any help. 0 1520 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: techprot-google04 |
last post by:
I've found tons of sample code on pinging - but all start with the host
name, resolve the ip address and do the ping.
Does anyone have any sample code that does a ping from an ip address
alone?
OR
Does anyone know how to add an ip address to the the address list of an
IPHostEntry object? I've tried ihe.AddressList =... but I can't
|
by: Richy |
last post by:
Hi,
I am running VB Express 2005 and have been developing an application
fine under Windows XP, but now I have switched to WIndows Vista I am
getting strange behaviour with the PropertyGrid control. The problem
not only happens on the IWindowsFormsEditorService that I have
provided myself, but on the generic Color dropdown.
When I click the dropdown arrow next to a property in the Grid (be it
Color or one of my own), one of three...
|
by: Bob |
last post by:
Hi,
I have some code that sets up an asynchronous server. It is working
fine on my XP machines but I can't get it to work on Vista.
Actually, it "works: in that it runs but when I try to connect via
telnet I get nothing. I have tried opening up the port and also
turned off the firewall. Neither seems to work and it won't accept
conections. Does anyone know of anything else I should do?
Thanks,,
Bob
|
by: Wayne |
last post by:
Several of my Access 2003 databases are exhibiting the same problem
under Windows Vista. Charts in forms are not showing any data.
Reports are not affected. Charts in reports display as they should.
The chart object in forms appears but contains no data. It appears
to be a screen painting problem because if I open a report or another
form on top of the form that is not showing the chart, when the second
report or form is closed, the...
|
by: Valerie Hough |
last post by:
My app currently runs C#, .NET v2.0 on Windows Xp/Windows Server 2003, using
asynchronous socket communication.
I set up my server socket:
Socket s = new Socket( AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp );
IPEndPoint ep = new IPEndPoint( IPAddress.Any, 0 );
s.Bind( ep );
int port = ep.Port;
| |
by: mindspring |
last post by:
A pc that was created in MS office xp's Access 2002 has been working fine on
a windows vista Ultimate pc that has MS OFfice Vista Edition. But all of
the sudden it stopped working and gives this error, when a button is
pressed. The button launches procedures to download and parse XML files.
This error occurs when an event has failed to run because Microsoft Office
Access cannot evaluate the location of the logic for the event. For...
|
by: Arno R |
last post by:
Hi all,
So I bought a new laptop 10 days ago to test my apps with Vista. (home premium)
Apparently Office 2007 is pre-installed. (a time limited but complete test version, no SP1)
So I take the opportunity to test some new features of Access2007 before actually 'stepping over'.
First thing that troubles me of course is 'the ribbon', but my question now is about speed.
I opened one of my Access 2000-apps in Access 2007.
Speed and...
|
by: jehugaleahsa |
last post by:
Hello:
We are working in VS 2005, C# with Team System. We have a text box
that is bound to a business object property. We have some code behind
that will populate the text box when they choose a value from a
validation form. It works on everyone's machine, except for the one
that deploys using Click Once. We have debugged the code, watched the
value get returned by the validation form, see the business object
property be set to the new...
|
by: =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?= |
last post by:
On reflection, you could possibly make the app a self extracting zip file
which extracts the EXE and a settings file and then starts the app, then when
you app closes, it can repack the settings file and itself into the exe. You
would probably want a tool for this bit which could be in the zip too.
So the app isnt single exe when running but when not running, it is.
Just an idea for you to think about.
Another option would possibly be to...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |