|
I want to write an application to read data from a specific IP address and Port. I have been searching for solutions on internet and understand that I need to use TCPlistener.
- My PC will act as server or client? does it matter when i write the application?
- how can I test my Tcplistener application? I would like to send data to a port and read it using my application and send data back. Please let me know if i need to edit any setting on router as well.
thanks
chun
|
|
|
|
|
Chun2 wrote: I want to write an application to read data from a specific IP address and Port
Are you says that you want to monitor the traffic going to/from that IP?? Is that IP on your machine or another, remote, machine??
|
|
|
|
|
hello everyone,
I would like to know how can i read the IP address!can anyone help me?
Thank you !
|
|
|
|
|
Start
run
cmd.exe
ipconfig
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
You not help me!in vb i mean!
|
|
|
|
|
|
|
You can use VB.Net class to get the local IP or by using Winsock Object
I don't know if they are both the same (Winsock is included in vb.net class)
#1
Dim _WinSock As Object
Dim _LocalIP As String
_WinSock = CreateObject("mswinsock.winsock")
_LocalIP = Trim(_WinSock.LocalIP)
Debug.print(_LocalIP)
#2
Dim _HostName = System.Net.Dns.GetHostName()
Dim _IPAdress = System.Net.Dns.GetHostAddresses(_HostName)(0).ToString
Debug.Print(_IPAdress)
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Hi,
your computer does not know what its public IP address is, since that depends on how you connect to the internet; intervening devices (your DSL modem, your provider, ..) can alter your public IP address. The only way to get it, is by getting it returned from some web site.
I have a page that does exactly that: http://www.perceler.com/getipadr1.php[^]. Send a WebRequest for it, and get the Response.
|
|
|
|
|
Nice Site
And here is the code to do it.
Dim _xmlHTTP
Dim _URL As String
_xmlHTTP = CreateObject("MSXML2.XMLHTTP")
_URL = "http://www.perceler.com/getipadr1.php"
_xmlHTTP.Open("GET", _URL, False)
_xmlHTTP.Send()
Debug.Print(_xmlHTTP.responseText)
Is that what you mean by WebRequest ?
I am asking to learn more feature. Thanks.
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
|
Hi Luc,
Almost all my example depends on object (WMI or CreateObject) which I used to use in VFP, So that i am trying to find VB.Net Pure code.
Thanks for the link, Very Usefull
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
Hi again,
I have added example code to my web page on getipadr1[^].
It is C# code, but the same can be done in VB.NET (VB.NET has a Using...End Using block, similar to C#'s using statement).
|
|
|
|
|
Much better than the Link microsoft you post.
Here is the vb.net version of your code.
Dim url = "http://www.perceler.com/getipadr1.php"
Dim req As HttpWebRequest = WebRequest.Create(url)
Dim resp As WebResponse = req.GetResponse()
Dim stream As Stream = resp.GetResponseStream()
Dim reader As New StreamReader(stream)
Debug.Print(reader.ReadToEnd)
Like car accidents, most hardware problems are due to driver error.
Samir R. Ibrahim
|
|
|
|
|
OK.
However you should call Close or use a Using...EndUsing construct to clean up the WebResponse, Stream and StreamReader.
|
|
|
|
|
i have a dataset consisting of 3 tables table 1 is for insert , 2 for update and 3 for delete. if row one from table 1 is inserted only then row one from table 2 should be updated and so is with table 3. if any operation fails then all the data of row one from all three table should not happen. then they should move to next row.
one way is i use a for loop and apply transaction to the command and use logic for update and delete transaction.
but is there a way in .net where i can use transaction to a datatable and sync insert , update and delete operation between 3 tables.
|
|
|
|
|
nitin_ion wrote: but is there a way in .net where i can use transaction to a datatable and sync insert , update and delete operation between 3 tables.
Not that I know of. Your design sounds like a horror.
You could move the processing into a stored procedure but it would still be 3 operations wrapped in a transaction.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I am beginner in Visual Basic and i am using Visual Basic 2008 Express. I would like to do the following from a Visual Basic progrma:
a) Create a Microsoft Access Table with primary key and columns (Name, Address, Country, Tel No)
b) Insert records into the Access Table, after getting user input for Name, Address, Country and Tel No via textboxes
Can anyone kindly advise me some sample codes using the OleDBCommand? I tried to googling around but i'm stuck with creating the Access table with primary key.
Thank you very much for your kind help.
Regards,
|
|
|
|
|
If you download the VS2008 Samples[^], you will find examples of how to do this sort of thing in the Data Samples directory.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi to all,
Can we disable the right click of the mouse, (so that when my application runs teh user cannot do right click on the task bar and ends the process of my application)
thanks
|
|
|
|
|
You cannot stop the user from ending your application. All they would have to do is start TaskManager click on your app in the Process tab and click End Process.
|
|
|
|
|
Your requirement sounds far too suspicious for anyone to help.
जय हिंद
|
|
|
|
|
Hello,
I created a form in designer view with image bitmaps on them. I cannot do much in my code according to the compiler error that I have the images as read-only.
None of the images can be set to a value of image; windows.systems.forms.bitmaps doesn't allow it.
Any help on how I can make the form write and read or parts of the form, like the images that I want to move on the form would be appreciated.
Thank you in advance.
|
|
|
|
|
Your description makes no sense at all. I have no idea what controls and properties you're talking about that are "ReadOnly". If you ran your project and then went back to Visual Studio to make changes, and your app is still running, then, yes, nearly everything is going to be ReadOnly. You have to stop the app first, then make the changes in the designer.
|
|
|
|
|
I did stop the app and looked in designer view, but there is no attribute I can set for the property of the form to be writable. Basically, I'm trying to move images on one part of the screen to the top of other images on the other side of the screen, in a drag drop operation. It doesn't work as I thought; I read several tutorials and tried different code, but nothing seems to move on the form at run-time.
I hope this is a better explanation.
|
|
|
|