Net.Sockets Wait For Streamwrite?
Nov 25, 2011Net.Sockets wait for streamwrite?
View 2 RepliesNet.Sockets wait for streamwrite?
View 2 RepliesWhile navigating to a series of sites at one site the WebBrowser control's DocumentCompleted EVENT is tripped and no other recorded Browser events occur after that. When this happens the hour glass cursor indicates the browser is waiting. From this point it take 120 to 250 seconds of wall clock time before the browser resumes. I am looking for a way to force an abnormal termination without destroying the control. I have tried "Stop", "nav to about:blank" repeatedly without success. How can I force an abnormal termination when the Cntrl is in a wait state?
Consider the following: The last known Browser event to be tripped is a Document Complete event; nothing else occurs after this. When this transpires the Cntrl is waiting.
1:50:657: ============================= ENTER WebBrowser1_DocumentCompleted EVENT ========================================
31:50:657: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^THE NEW WEBBROWSER STATEMENT
[code]....
I am writing an application which involves reading xml over socket. The messages arrive at socket asynchronously. How can I ensure that data is received in form of complete xml elements, validate received data and which classes will be helpful for me in accomplishing my goal.
View 1 RepliesCan i implement PTP (precision time protocol) or NTP (simple network timing) with sockets?
If so, how can i use them to send small packages (4 to 33 bytes) with the smallest delay possible?
P.S. I would prefer to know more about PTP, I've heard that it has smaller delay.
I have an application in vb.net which will connect with an hardware device and test its functionality. The hardware device basically spits out data continuosly through Ethernet. That is it recieves some data via com ports and spits out the processed data via ethernet.So my application does both. Thats pretty much the entire app.My problem is i am using tcpclient sockets. Now when i connect a tcpclient to the device using
tcpclient.open(ip,port);
Immediately the device sends some data which comes and get stored in the clientsocket. Then i send a command to it ,only then i read the data from the clientsocket using
tcpclient.getstream().read()
at this time the entire data that is the one which flowed immediately when connected to the device and the one that i actually need after passing command is both acquired. This is undesirable. I need the data which i read only after sending the command. So i was wondering if there is any way to clear the tcpclient socket before we do a read. The manual doesnt show any such method.
Here is an issue with a socket I am having:
Public Sub Connect(ByVal server As String, ByVal port As Integer)
Dim IP As IPAddress = IPAddress.Parse(server)
Dim EP As IPEndPoint = New IPEndPoint(IP, port)
[Code]....
The socket is declared like this, at the top of the code:
Dim sock As Socket
What is wrong here? It says Object reference not set to an instance of an object, which is a NullReferenceException.
I am using Nektra's Deviare to hook winsock's send method calls. My ideia is to learn to also send messages through the same socket than the original application. So what I'm doing is when i detect the first call to send message, I save the socket id(the first argument of the send function), so I can use it later.
So here is my code:
uint socket = 0;
[DllImport("Ws2_32.dll")]
private static extern int send(uint socket, string buf, int len, int flags);
[Code].....
This last messagebox is poping up always -1. Why should be it?
edit: calling WSAGetLastError() returns 2. Which I do not know what it means, as it doesn't seem to appear on msdn.
i am using vb.net and i would to send some structs to a C++ tcp server.The problem is the structs i am sending might contain other structs.[code]Lets say i want to send FirstStruct over to the C++ Server.
View 2 RepliesI am actually new to VB.net...i have managed to create Sockets and communicate over them..but i dont know how fire sql queries through sockets as they take in Byte data as a input...i want to actually pass queries through sockets and retrive those results...i am using mysql database....i have actually tried changing the connection string (the ip address) for a static network but i think sockets are better for dynamic ip networks.
View 1 RepliesThis code will allow you to send Emails using only .NET Sockets. This code was adapted from sample code on[code]...
View 7 RepliesSo basically I would like to know what goes on behind smtpclient, webrequest and all those.
I would like to know if its possible to connect to an smtp server with sockets. Also, can anyone recommend a good OOAD(object oriented analysis and design) tutorial or book?
I know there are lots of examples here on the forum, but all to difficult to understand.I have a client:
I have a client:
Imports System.Net.Sockets
Imports System.Text
[code].....
i want to send an multiple screenshot image.. and i want them to send one by one from my client to server. im using vs2008.
View 1 RepliesI'm building a program that has a very basic premise.
For X amount of Objects
Open Conection
Perform Actions
[code].....
Do you all have any updated websites that provides tutorials about the system.net.sockets namespace?
View 1 RepliesI have a chat program using System.Net.Sockets.Socket that works perfectly over LAN.My question is - will this same program work over the net with little or no modification and if so do i provide the client with the IP of my machine or of my router and use port forwardin
View 1 RepliesI'm using System.Net.Sockets namespace for connecting to an ftp server. If a user has to login to a firewall first though, I'm not too sure what to do. The following is what I have working for logging into an ftp server without a firewall. (The Else statement) Do you know what I might add to the if statement? In the method where this conditional is, I am passing a firewall username and password.
m_tcpClient = New TcpClient
' Try to connect to ftp site
' If using firewall, login to it first then issue another command to log in to actual
[code]....
I made a TCP server which communicates with multiple clients at once, but I can't seem to be able to make them stable. When one of the client sends 100 packets to the server, the server receives only a few of them.Here's the client code in PasteBin. It shows how the client connects to the server and then sends 100 messages in a For loop to the server.And here's how the server handles the connection. I couldn't paste the full source as it's hundreds of lines long so let me know if it's missing any mandatory parts and I'll upload them as well.
View 1 RepliesI'm using vb .net 2008 with 3.5 framework. (the following 2 classes are put in a DLL that i import in a main application)
Server class:
Code:
Imports System.Xml
Imports System.Net.Sockets
Imports System.Text
Imports System.Net
[code]....
Basically in my main application i am instantiating the client class from this dll, as well as the server one. On the client form i got a "send data" (SendFISA sub) and a "connect" button. After connecting the client and clicking on the "send data" i am sending to the server a string formed of some information created when instantiating the client class from the dll (i can't make that type of data public, but i'm just using a constructor to assign values to a class object, nothing special).
Now, when the server receives the data sent by "send data" button click it responds with "PKG_SENT" corresponding to the "FISASENT" string terminator(in the module) of the string that was sent. The "WRONG_MSG" constant is for when the string terminator is different from the 2 from above.
On the local disk, if the server cannot be reached, the client saves an xml file with this data. In the dll i made a timer that ticks every 5 seconds and checks to see if there is any xml file on the disk and sends it to the server if the connection is ok (trimiteXML sub). The server would respond with "XML_SENT" corresponding to the string terminator "XMLSENT"(in the module) appended to the read string from the xml file. After the file is sent it is deleted from the local dir.
The problem occurs when i click "send data" AND there are XML files to be sent from the disk. I believe they are interpreted by the server somehow at the same time because the message is neither "PKG_SENT" nor "XML_SENT", but it becomes a combination of the "WRONG_MSG_TYPE" and "XML_SENT", "XML_SENTG_TYPE". I have no idea why this is happening and i basically want the socket to wait with sending the files from the disks until the "send data" finishes.
I'm constantly trying to improve my coding abilities. I'm trying to learn the ropes on using .NET Sockets but everything I'm finding it pretty cheesy and doesn't really go over the details of what each piece of the code is about.Can anyone point me to a great tutorial or site where I can get started?
View 2 RepliesBe able to instantiate the object and hook up the MessageReceived and ConnectionChanged events (or ones with similar purposes). Be able to send data (duh) When data is received, it fires the MessageReceived event on the same thread that the object was created on (this would be nice, but not absolutely required). Have a blocking and non-blocking options for connecting and possibly sending data.
View 2 RepliesI'm trying to setup an asynchronous client and I can send/receive one command and response, but when I try to send the second command, the command is sent (I verified by code inspection), but I am getting no response.
Heres the code, a majority of it is from the Microsoft example.
Option Explicit On
Imports System
Imports System.Net
[Code].....
I have written some code to check if a port is open. I'm currently trying to work with the system.net.sockets name space.I know that the easy way out would be to use AxWinsock, but I don't think the AxWinSock is very cool, nor do I think it's very professional when trying to make network applications in VB.NET.
I've got this Error message : Socket Exception Was unhandled, No connection could be made because the target machine actively refused it 127.0.0.1:1 IDK, Like I said, I'm new to the System.net.sockets namespace, I'm pretty good with other stuff in VB.NET, but when it comes to the serious stuff like the system.net.sockets namespace, I'm not so great.look at this code and tell me what I am doing wrong, I've manged to get this far, and I don't want to just give up and continue watching my movie.
[Code]....
i have this code from msdn and added some of mine..
Public Shared Sub DoAcceptTcpClientCallback(ByVal ar As IAsyncResult)
' Get the listener that handles the client request.
Dim listener As TcpListener = CType(ar.AsyncState, TcpListener)
' End the operation and display the received data on
' the console.
Dim client As TcpClient = listener.EndAcceptTcpClient(ar)
' Process the connection here. (Add the client to a
' server table, read data, etc.)
Dim networkStream As NetworkStream = client.GetStream()
Dim bytes(client.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(client.ReceiveBufferSize))
Dim clientData As String = Encoding.ASCII.GetString(bytes)
MsgBox(clientData)
' Signal the calling thread to continue.
tcpClientConnected.Set()
End Sub 'DoAcceptTcpClientCallback
now the question is how can i put the clientdata from a listview?
i tried to put the listview control in this shared sub but i always got an error..
Quotecannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit initializer of the class
please enlighten me on this one..
Alright Simple question I got my main thread running Form Load and I make a socket then called BeginAcceptthen I pass AR to a Function that handles the Accept and creates a whole another sockets out of it and then loops for recv then when it gets everything closes then exits the functionbut how do I make the Socket from Form_Load run BeginAccept again to wait for another connection.. Do I call that command and Point it to the same Block thats Currently running, The block that Handles the AR Param??
View 3 RepliesI am new to vb.net (2010) and am working on a project that has to send information from a client application form to a php-based web page.
View 1 RepliesI have a VB application where winsock is used. I want to convert it to VB.Net, so as I understand I should use System.net.sockets to do this.
But the problem is in the VB application multiple sockets are created by using the index feature of the winsock . example
Load Socket(isocket)
where isocket is an integer variable that is incremented each time, for a new connection request.
So how do I do the same, ie. open multiple sockets in vb.net?
Download file asynchronous using sockets
View 8 RepliesI am developing a program that gets the html source code of a certain webpages in a website.
I already developed one program that does so here's the code
Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(TextBox2.Text)
Dim response As System.Net.HttpWebResponse = request.GetResponse()
[Code]....
Recently, I found out that I could do the same using Sockets. This time I want to parse HTML of those web pages SIMULTANEOUSLY. I tried parsing simultaneously on my previous program using multithreading but my bandwidth keeps decreasing as threads increase so, to make my questions short,
How can I parse many web pages' source SIMULTANEOUSLY without decreasing my Bandwidth? Does using Sockets in multi threading decrease Bandwidth? (If anyone tried)
How to create multiple sockets as an index
View 3 Replies