|
Dim ret_code as integer = socket.IOControl _
(SIO_RCVALL, bin, bOUT)
i get the error End of Statement Expected on the Above line of code
Imports System
Imports System.Windows.Forms
Imports System.Net.Sockets
Imports System.Net
Imports System.Threading
Imports System.Text
Public Class Form1
Inherits System.Windows.Forms.Form
Public listener As Thread
Private Sub btnstart_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
btnstart.Enabled = False
btnstop.Enabled = True
listener = New Thread(New ThreadStart(AddressOf run))
listener.Start()
End Sub
Private Sub btnstop_Click(ByVal sender As Object, _
ByVal e As System.EventArgs)
btnstart.Enabled = True
btnstop.Enabled = False
If Not listener Is Nothing Then
listener.Abort()
listener.Join()
listener = Nothing
End If
End Sub
Public Sub run()
Dim len_receive_buf As Integer = 4096
Dim len_send_buf As Integer = 4096
Dim receive_buf() As Byte = New Byte(len_receive_buf) {}
Dim send_buf() As Byte = New Byte(len_send_buf) {}
Dim cout_receive_bytes As Integer
Dim socket As Socket = New _
Socket(AddressFamily.InterNetwork, _
SocketType.Raw, ProtocolType.IP)
socket.Blocking = False
Dim iphost As IPHostEntry = _
Dns.GetHostByName(Dns.GetHostName())
socket.Bind(New _
IPEndPoint(IPAddress.Parse _
(iphost.AddressList(0).ToString()), 0))
socket.SetSocketOption(SocketOptionLevel.IP, _
SocketOptionName.HeaderIncluded, 1)
Dim bin As Byte() = New Byte() {1, 0, 0, 0}
Dim bout As Byte() = New Byte() {0, 0, 0, 0}
Dim sio_rcvall As Integer = &H98000001 _
dim ret_code as integer = socket.IOControl _
(SIO_RCVALL, bin bout)
Do
Dim ar As IAsyncResult = socket.BeginReceive _
(receive_buf, 0, _
len_receive_buf, SocketFlags.None, Nothing, Me)
cout_receive_bytes = socket.EndReceive(ar)
Receive(receive_buf, cout_receive_bytes)
Loop
End Sub
Public Sub Receive(ByVal buf As Byte(), ByVal len As Integer)
If buf(9) = 6 Then
lbpackets.Items.Add(Encoding.ASCII.GetString _
(buf).Replace(Chr(0), " "))
End If
End Sub
End Class
|
|
|
|
|
You're killing yoursel;f with all these line continuations. Just don't use them this much.
This is what got you into the trouble. Remove the line continuation character (_) from the line BEFORE the one that threw the error:
socket.Bind(New _
IPEndPoint(IPAddress.Parse _
(iphost.AddressList(0).ToString()), 0))
socket.SetSocketOption(SocketOptionLevel.IP, _
SocketOptionName.HeaderIncluded, 1)
Dim bin As Byte() = New Byte() {1, 0, 0, 0}
Dim bout As Byte() = New Byte() {0, 0, 0, 0}
' This next line caused the error...
Dim sio_rcvall As Integer = &H98000001 _
dim ret_code as integer = socket.IOControl _
(SIO_RCVALL, bin bout)
Do
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
cool it is working now ty for the help
|
|
|
|
|
I don't know if this affects C#, but it was pointed out to me that a .NET application uses huge amounts of memory. I was wondering if anyone could shed some light on this or send me some links on Memory Management?
For example, create a new VB.NET Windows Forms project. Do NOT add any code to the Form. Run the program and look in the task manager under your Program Name. You'll notice probably about 8,000 - 12,000 kb of memory being used. Now, Minimize the Form and the Memory drops to 600 - 650kb!!! Restore the Form and now it only uses 1500 - 2000 Kb of Memory! What in the world is going on!?
Has anyone else noticed this? I have a feeling it has something to do with GDI and Painting but I am not sure.
|
|
|
|
|
It's nothing you have to worry about and just about everyone has noticed this.
When your app is launched, you have the entire weight of the .NET Framework loaded behind it, taking up a bunch of RAM. When your app is minimized, a bunch of data and code is moved to the page file and out of RAM since it's not being used by a foreground process. When your app is maximized again, only the data and code that gets executed and referenced gets moved back into RAM and out of the page file. When the is being used and exercised, more data and code will get moved back into RAM while seldom used data and code gets moved back to the page file. It's that simple.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Rage - do you happen to know if, in a System Tray application, the memory remains allocated? Looking at the Task Mgr, it seems that my fairly simple app is sucking 12MB while the icon just sits there. Thanks!
Hal in AZ
|
|
|
|
|
Same thing. When the .NET Framework detects Windows getting low on memory, it'll start swapping things to the pagefile as needed.
No! You're application will NOT hold onto 12MB of physical RAM while it's idling AND the system needs memory. If Windows can afford to let an application be a hog for awhile, it will. When memory starts to run low, the .NET Framework will start tightening its belt. Until then, there's no reason why your application and the Framework can't stay in memory. It helps with performnace if there is no page swapping going on.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanks Dave! That makes it less painful.
Hal in AZ
|
|
|
|
|
How can i add description or tooltip about my function and their parameters just the way microsoft provide for their functions.
|
|
|
|
|
if u mean to add descriptions to show in design view, USE COMPONENT MODEL NameSpaca , For Example;
Dim proItemCount as Integer=0
<system.componentmodel.description("returns items="" count="" in="" list")="">
public readonly property ItemCount as Integer<br />
Get<br />
return proItemCount<br />
End get<br />
end property
if u mean to show them in code view. i think it is prerogative for Microsoft. I tried a lot of method, but i couldnt any way.
Listen the same song when writing code, your concantrate will increasingly increase. #1 Britney Spears (it's my PreRogative) #
|
|
|
|
|
Dim proItemCount as Integer=0
<System.ComponentModel.Description("item Count in list.")>public readonly property ItemCount as Integer
Get
return proItemCount
End get
end property
==============================================================
SORRY i forgot to checked " Do Not treat <'s as HTML tags"
==============================================================
|
|
|
|
|
If your talking about the descriptions you see in Intellisense, it's not supported natively by VB.NET yet (it will be in Visual Studio .NET 2005). To get this to work in 2002/2003 you'll have to install an add-on such as the VBCommentor PowerToy, found here on GotDotNet[^].
This will let you comment your code in the appropriate format and the VBCommentor will generate the XML file needed to show your comments in Intellisense.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello there
I have build an image viewer. where user can zoomIn and Zoom Out with some other functionalities.. The problem is when I zoom In or Zoom out the image , I am unable to get the exact location where user clicked on the image as it gives me the location (e.X )on mouse down event of picture box which is the location of picture box where user clicked. but when image is zoomed it internally zooms the pixels. so my location to image control becomes different then the pixel where user exactly clicked on. So when I need to Draw a Circle or Rectangle on that clicked location it appears some where else.
details for zoomIn ::::
picImage.SizeMode = PictureBoxSizeMode.StretchImage
picImage.Width = width + 100
picImage.Height = Height + 100
Can any body tell me the solution for this ??????
to get the X and Y on image when user clicks on the Image Control.
Rizwan Bashir
|
|
|
|
|
Yeah, you know the zoom factor, and the scroll position, so do some maths to convert the point you clicked to a point on the image.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hi, I’m preesteya. I’m one of researcher at technical university.
I’m using Microsoft Visual Studio .NET 2003. I created an application using VB.NET. Now I must send .exe of my application for testing. How to create .exe file? As I know every time a program get debug using VB.NET the .exe file will be created in bin folder. But my case I can’t get the .exe file. Can somebody help me please?
Many Thanks
Preesteya.
|
|
|
|
|
I'm using NET 2002, but I don't think the IDE changed much:
From IDE menu, select
Build>>Configuration Manager. A dialog is displayed that aloows you to set the active build to release version.
Robert
|
|
|
|
|
It should be either in MyProjectDir\bin\Debug or MyProjectDir\bin\Release. If not right click your main project (the bold one) and click preferences. Search a bit... the settings where the build output is going to can be changed here.
btw: Dont forget that the tester needs the framework in order to start your executable
|
|
|
|
|
Hi,
Right click on project and what's the Output Type .....
It should be Windows Application and check the
Configuration Properties-->Build-->Output Path where exe is created.......
I hope this will help u................
Reagrds,
Ritesh
|
|
|
|
|
I was wondering if anyone has some good resources on how to create a .NET component that is accessible by using VBScript and Classic ASP. I know this is possible according to some of the things I've read, but I can't seem to find and actual implementation guides.
Any help is appreciated!
Thanks!
|
|
|
|
|
You can create COM components in .NET, which is the only way I can imagine this working.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
On top of what Cristian said, the machine will have to have the .NET Framework installed just to use your component. You might want to start reading up on Exposing .NET Framework Components to COM[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank's for the information. The problem I am having is exposing it to VBScript. Whenever I use the following command I get a non-descript error:
Set PageRender = Server.CreateObject("MC.PageRenderer")
Here is my code. I'm trying to keep it simple until I understand how to implement it.
<Guid("3BFA03FD-B85D-48de-A9E8-FAE266B2D809"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _PageRender
<DispId(1)> Function ChooseContent(ByVal CalWidth As Integer, ByVal CalHeight As Integer) As String
<DispId(2)> Function GetNews(ByVal Width As Integer, ByVal Heading As String, ByVal IsImage As Boolean) As String
<DispId(3)> Property Action() As String
<DispId(4)> Property SubCommand() As String
<DispId(5)> Property ID() As Integer
End Interface
<Guid("385AA220-84CD-4e25-A736-E3356C33F4A8"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("MinistryCraft.PageRenderer")> _
Public Class PageRenderer
Implements _PageRender
Public Property Action() As String Implements _PageRender.Action
Get
End Get
Set(ByVal Value As String)
End Set
End Property
Public Function ChooseContent(ByVal CalWidth As Integer, ByVal CalHeight As Integer) As String Implements _PageRender.ChooseContent
Return CalWidth & "W x " & CalHeight & "H"
End Function
Public Function GetNews(ByVal Width As Integer, ByVal Heading As String, ByVal IsImage As Boolean) As String Implements _PageRender.GetNews
End Function
Public Property ID() As Integer Implements _PageRender.ID
Get
End Get
Set(ByVal Value As Integer)
End Set
End Property
Public Property SubCommand() As String Implements _PageRender.SubCommand
Get
End Get
Set(ByVal Value As String)
End Set
End Property
End Class
Do I need to register this assembly with the global cache?
|
|
|
|
|
If you going to share this thing with a bunch of different evnironments and applications, then yes, I'd put in the GAC. Also, you'll have to use RegAsm to register the assembly for COM use.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
If you are getting the "Can't create Activex Component" error is because you either:
a. did not register the component for COM use
b. did not copy the component to the same directory where the calling program is located.
All the information you need is found in the resources already mentioned by other people.
|
|
|
|
|
PLease let me know the provider or the connectionstring i should use to
read a .dbf file.
|
|
|
|