before you say something like "just search the forum for socket programing examples" I did and came up with things that were to complicated for me e.g multi threaded etc even a chat server that holds users names in a hash table i couldnt quite grasp so im asking if anyone can give me a few pointers maybe link me to a website that i havnt stumbled apon in my google seaches that contain infomation just about basic tcp server that recieves text strings no fancy users or anything like that.
I wrote a Socket Client which will send the Socket Server some data and get some response from Server. This process will be running once in every 2 seconds.
Now what I need to know is How we can identify the connection lost between Server and Client?
I need this to be implemented in the Client side. If there is no connection then Client should automatically close the connection. Once the connection with the server is available in the next attempt it should connect automatically.
I am trying to make a program that converts the weight of objects on earth into other planets. i have trouble with naming things like weight ratio and planet because VB program doesn't accept the coding. i don't know where to put theh data in the disk so that the program can access it when it runs.
Imports System.IO Public Class weightcalc Private planet structure
Im an electrical engineering student, and I am trying to utilize the serial port to give me high and low digital states. What i want to do is simply turn on an LED or turn it off. the basic gist of what I have been trying currently is that on a button click, serialPort1.DTREnable = enabled or disabled, indefinitely until the next button click.
So far, I have only been able to get the LED to momentarily flash... It seems to begin in an active state flash off, then immediately, return to its active state. I am using Visual Studio 2008. Can I use DTREnable to generate on/off states by enabling or disabling the pin? Is there a tutorial somewhere for electrical engineering applications using visual studio 2008?
I created a project in Excel-VBA (wich I'm also new at) that connect to a SQL. It retrieves data, puts it in arrays, calculates, writes it up nicely and mails it to a mailing list before it closes itself down. This works when Excel is stable on the server, which it is not. Therefore I'm set on rewriting it to VB.NET (just have to learn it first).Project:To build this project in VB.NET I wanted to try and make it Object Oriented (OO). I have read that OO is when I create a Sub or Module for different tasks. Are there any advantages in learning/doing this from the start? I plan on creating Subs for almost everything, and then call it from a Main sub.
Too much OO?: These are the modules I plan to create (and call) Connect to SQL moduleSet up a query and put data in arrays moduleCalculation moduleOutput
I am trying to get a better understanding of the uses of arrays in programing, and have been wondering why do programmers use an array when working with mathematical concept such as Fibonacci sequences? why are arrays so prevalent in coding now a days.
Below is my code, but when i send the message thru client socket i receive Specified argument was out of the range of valid values. Parameter name: size
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim serverStream As NetworkStream = clientSocket.GetStream() Dim outStream As Byte() = _ System.Text.Encoding.ASCII.GetBytes("0800822000000000000004000000000000000920092126012345001")
how to do socket programming in VB. I'm using VB.NET 2008 and i'm a novice but with a reasonable understanding of programming so I want to learn by examples and understanding it in a novice/intermediate point of view. Essentially, I want to create a simple TCP or UDP client that can connect to an IP and port and retrieve the stream for parsing of content.
i'm currently using my computer as host and client.. i ran the program and the console application for the server started.. but how will i be able to run the form application for the client? can VS run 2 programs at the same time?
I have closed the client socket using client.close() but netstat command shows the same socket in time-wait state.Because of this I am unable to reuse the socket..
my goal is to control the incoming and outgoing packets to a game server, to alert when a game round finishes the main code is this:
Private Buffer(65535) As Byte Private RawSocket As Socket Public Event PacketReceived(ByVal PacketBuffer() As Byte)
[code]....
this code works perfectly with XP (you can read both incoming and outgoing packets to the game server)... with Vista the same code displays ONLY the incoming packets....
i got a program thats checks IP adresses and their host names by loking at the ip adress, but 1.- sometimes one ping responds but i get a socket this is the code hello = its the ip (it gets the ip from a list from a datagridview list)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim hello As String Dim sum As Integer
My code works fine under xp pro but not under windows 7 ?System.Net.Sockets.SocketException = {"The system detected an invalid pointer address in attempting to use a pointer argument in a call"}
I am using Async socket class to handle HTTP data. The OnRecieve event handler looks like this: Private Sub sck_onDataArrival(ByVal sData() As Byte, ByVal BytesTotal As Integer) Handles sck.onDataArrival Try Dim ms As New IO.MemoryStream(sData) Dim returnImage As Image = Image.FromStream(ms) Picturebox1.Image = returnImage Catch ex As Exception Debug.Print(ex.ToString) End Try End Sub
I realize this will not work because the byte array still contains the header information from the response from the server. How to strip this data without converting the byte array to a string. I need to strip the header response information and just be left with the image data and from there convert that data into a stream so the stream can be loaded into an image and displayed in my picturebox.
i need a little advice/help here. There is a particular scenario that is coming up and I am clueless as to how to go about it."I will soon have a lease line through which I will get realtime stock market data. This data will be available every second and it will contain prices of stocks. Now assume I am able to get that data on my local computer. How can I transmit data so that users can get that data through my software.
For e.g. assume it's 11 AM. Now if you select a stock e.g. Google, then my program should fetch data for google till 11 AM and also show new data every second or so with minimum lag. Something like a terminal where you see stock prices getting updates every second. In my case I need to get past data and show current data which get updated at short intervals."
Now I have a linux vps webserver which hosts my site. (I get one or two static ip free) What to do so that data goes from my local computer to my server and then my program (developed in vb.net) is able to get it and show it to end user. This whole system should such that its fast (real-time) and delay is minimum.
im trying to detect if the connection is still active upon trying to send or receive anything. Now I have checks in place if it's connected then it will send or receive however... it's saying it's connected when it is not connected... and therefore my program tries to send and receive and errors.
I am determining if it is ok to send and receive by using the Socket.Poll(-1, SelectMode.SelectWrite)
if it's true then im connected and data can be passed..This seems to always be true until I send something and it fails..How can I catch the socket not being connected before it fails upon sending or receiving?
I realize this is a broad question, but how do I recieve / send packets. I know what packets I need to send and what Im going to recieve, but I dont know how to send / recieve them.
I have been working on recoding a VB6 client/server application of mine and have run into a bit of an issue with storing the players location on the tile map which means I will need to rework the way I am storing the user connections. In my VB6 application I would store the user's numeric index/socket number/whatever you'd like to call it as the Key, however, in VB 2008 I can't seem to find where, or if, the numeric index is stored. If this isn't possible then does anyone have an example of how they store user connections using some numeric index as the key of a hashtable?
i try to transfer packets from the PC to the Mobile phone~ my PC is act as a Server and Mobile as a Client. My Mobile is successfully connect to my PC, but when i try to pass a packets from Mobile, it went failed without any error. The Server didn't receive any packets from Mobile. i had test my code on PC to PC and it's work fine. Anyone have this kind of experience?
I am facing problem in asynchronous socket communication.
1)I wanted to perform connect(from client to server) operation on enter button and send the data whatever client want to send and disconnect from server. And again client should get connect to server whenever client wanted to send data. this is the mechanism.
i.e how to reuse the socket.
2)Again Server should able to send the data to client.
I have been developing an async socket connection server and client program. I have been testing it, and noticed that if I connect to the server from my client and then disconnect. Upon reconnecting I am on a different port(local IP still). This is fine, however when I go to send a message, and the server trys to update all the clients, it eventually hits clients that do not exist anymore. I get the SocketException 10054, and upon connecting/disconnecting enough, it no longer works at all. My question is how do I clear out these no longer useful sockets from the server? I am doing currentsocket.Shutdown(SocketShutDown.Both); and then a currentsocket.Close(); after that. When a user disconnects.
This is my first time writeing a program and i am stuck. i am just looking for were i should go next. i can't figure out how to write in code for the days in the getDay function.
Write a program that computes the cost of a long-distance call. The cost of the call is determined according to the following rate schedule:
a. Any call started between 7:00 A.M. and 9:00 P.M., Monday through Friday, is billed at a rate of $0.30 per minute.
b. Any call started before 7:00 A.M. or after 9:00 P.M., Monday through Friday, is billed at a rate of $0.15 per minute.
c. Any call started on a Saturday or Sunday is billed at a rate of $0.10 per minute.
The inputs will consist of (1) the day of the week, (2) the start/end time of the call, and (3) the length of the call in minutes. The output will be the cost of the call. Input will come from the user and outputs will be displayed via the console window.
so now my question is how do i connect the WebSocketServer.cs to the index.aspx ?
As a start, all I'm trying to accomplish is just to get the Web Sockets working, and have the connection established, which then will alert("Stock Ticker Connection open ...");
how do I keep a Socket declared forever so i can call it in other methods?
All the tutorials i've read just have a server, client, server sends client message, client disconnects. What if I want to remain connected? I've tried making the sockets global but that didn't work somehow.
Then I ran into problem #1 - I wanted to call the methods in another sub but they were shared so I received the error:"Cannot refer to an instance member of a class from within a shared method without an explicit instance of a class"o, I took out shared since I didn't know how to fix it, and put in the Following as Global Variables:
Public listener As System.Net.Sockets.Socket Public handler As System.Net.Sockets.Socket Public client As System.Net.Sockets.Socket
i can connect socket well but i want to ask how can i determine that socket has received data i want to create sub or function that handles socket.receive byte the code i have is
Dim byteData(100) As Byte Dim size As Integer = soc.Receive(byteData) 'receiving the data from socket and reading its size For i As Integer = 0 To size Console.Write(Convert.ToChar(byteData(i))) 'Convert.ToChar will convert the byte value into character Next
i want to start this code each time when socket receives something?
i'm creating an Asynchronous socket programming in vb.net. i've utilised the code from Asynchronous client and server code frtom the following links:m a new user so could post only one link fully)When I try to connect the for more than one client the second client always waits until the first clientcompletes the call. i want the clients to accept calls at the same time