Jump to content
Xtreme .Net Talk

sgt_pinky

Avatar/Signature
  • Posts

    81
  • Joined

  • Last visited

Personal Information

  • Occupation
    Engineer
  • Visual Studio .NET Version
    VB.NET Standard
  • .NET Preferred Language
    VB.NET

sgt_pinky's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I seem to get very strange errors in VS 2005 when I am linking project files. Say in one solution I have a project with some classes, then I create a new project in that solution (usually a Winforms app to test my Windows Service), and add all the classes by using 'Add as link'. Strange things start to happen - like this one. Name 'E' is not declared!!!! ROFL :rolleyes:
  2. Yeh, even though now in .NET 2.0 they have the IsNot keyword, I still use the old If Not Blah Is Nothing syntax because it has grown on me :-) kurf, you need to go back to school or something if you honestly believe that. Show me how to NOT program OO in VB.NET!!!!
  3. LOL. Just solved it. Always the way. I have had this prob for 2 days, and I solve it immediately when I have just asked for help :S Initially my TcpListener was a Sub-level variable. Then I made it a Class-level variable and created a new Sub: Public Sub StopServer() thConnect.Abort() If Not Server Is Nothing Then Server.Stop() End Sub Ah dear. Thanks anyway ;-)
  4. Hi, I have a multithreaded server app (Winforms) that I have converted to a service. It has a thread that simply creates a new TcpListener and waits for a connection: Public Sub StartListeningThread() Do Dim ip As IPAddress = IPAddress.Any Server = New TcpListener(ip, 4000) Server.Start() Dim tcpTmp As TcpClient = Server.AcceptTcpClient Dim tcpClient As New RUHTcpClient tcpClient.Client = tcpTmp.Client Server.Stop() Connections.Add(tcpClient) Loop End Sub This thread runs for the life of the application. The problem is that without using the command 'End', the application is blocking on this thread on the line: Dim tcpTmp As TcpClient = Server.AcceptTcpClient Server.AcceptTcpClient holds up everything. I have tried to Abort() the thread, etc, but that doesn't help. I can solve the problem using 'End' in the Winforms app, but in the service it causes all kinds of problems, and the program is left running in the taskmanager, even though it says 'Stopped' in the Services manager. TIA, Pinky
  5. Firstly, thanks for your quick replies HJB417. Yep, I'm using TCP. I did a bit more research on the 'Flush()' method, and I found that it is 'Reserved for later use.' I actually fixed my problem though. I was brute force testing a multiple connection server with a little app I made to generate lots of clients. Each time I clicked the button it generated a client, AND added a handler for each client! So when I had added 3 clients, I was getting 3 lots of messages ;-) Oh well, the best problems are the ones with the simplest solutions I guess. Thanks again, Pinky
  6. I have this problem when I am writing and reading network streams. If I send another packet, then it will also send the last packet again, so I end up sending more and more information. Somehow I mustn't be flushing the buffer out correctly or something. This is my output if I click a button 3 times - you can see by the third time it has sent the packet 3 times, and hence the server replies 3 times. To send a packet I am using: Dim ns As NetworkStream = Client.GetStream If ns.CanWrite Then Dim bytes() As Byte = Nothing bytes = System.Text.Encoding.UTF8.GetBytes(Msg) ns.Write(bytes, 0, bytes.Length) End If To receive a packet I am using: Dim ns As NetworkStream = cli.GetStream If ns.CanRead And ns.DataAvailable Then Dim bytes(cli.ReceiveBufferSize) As Byte ns.Read(bytes, 0, cli.ReceiveBufferSize) RaiseEvent NewPacket(cli, System.Text.Encoding.UTF8.GetString(bytes)) Else cli.Close() Connections.Remove(cli) RaiseEvent ClientMessage("Client connected from " & cli.Client.RemoteEndPoint.ToString.Split(":")(0) & " has disconnected.") End If I have tried closing the stream after I have finished writing, but that seems to destroy the socket. I have tried Flush() too, but not too sure how to use that one. Cheerio, Pinky
  7. Cheers big ears, that's exactly what I wanted ;-) Thanks.
  8. What is the best way to create an event that fires at 8am everyday? I have a method now that works, but I am sure it's not the best way. Maybe there is someway using API or something in .NET 2.0 that I am unaware of. TIA, Pinky
  9. No. Most are dialogs, shown with frm.ShowDialog()
  10. Hi, What is the correct way to do this. I have a windows forms app, and I want several of the forms to close when I press escape. So I have the general sub-routine in say 6 different forms, all with the same code: Private Sub CloseFormOnEscape(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles cmbSkin.KeyPress If Asc(e.KeyChar) = Keys.Escape Then Me.Close() End Sub In order to make my app more manageable, I could put the one subroutine in a general class, and just use AddHandler in the Form_Load() sub of each form. I was wondering if there was some better way that I could do it, using Inherits or something like that. This is a simple example, the actual code that I want to do this with is a class that is used to drag a skinned form, based on some specific controls. Cheers, Pinky
  11. I wouldn't use a surface. I would use a texture with the flag 'Dynamic'. Then display the texture using a sprite. Are you loading the bitmaps from existing files or from some kind of I/O stream? Are the files already there? For example, 200 files already in one directory? In which case, you can buffer 10 or so into memory.
  12. When you check your checkbox again, are you sure you are calling this subroutine again?
  13. You have to be joking. Google, Google, GOOOOGGGLGLLEEEE!!!!@@!11111 arrrgghhh.. http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx
  14. Yeah, I am going with the OCD diagnosis... Cool link Diesel, thanks.
  15. I'm not sure why you would want to do this. That is exactly what the World Matrix is for. You lose performance, and also possibly the advantage of hardware acceleration for the vertex calculations (if you have a decent GFX card), if you open up the VB.
×
×
  • Create New...