Advertisement
Advertisement
| 02.10.2008 at 09:40PM PST, ID: 23152260 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: |
Sub Test()
Dim tcpClient As New System.Net.Sockets.TcpClient()
tcpClient.Connect("192.0.3.18", 5555)
Dim networkStream As NetworkStream = tcpClient.GetStream()
If networkStream.CanWrite And networkStream.CanRead Then
'' Do a simple write.
'Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is anybody there")
'networkStream.Write(sendBytes, 0, sendBytes.Length)
' Read the NetworkStream into a byte buffer.
Dim bytes(tcpClient.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
' Output the data received from the host to the console.
Dim returnData As String = Encoding.ASCII.GetString(bytes)
'Console.WriteLine(("Host returned: " + returndata))
Print(returnData)
Else
If Not networkStream.CanRead Then
Print("cannot not write data to this stream")
tcpClient.Close()
Else
If Not networkStream.CanWrite Then
Print("cannot read data from this stream")
tcpClient.Close()
End If
End If
End If
' pause so user can view the console output
'Console.ReadLine()
End Sub
|
| Microsoft |
| Apple |
| Internet |
| Gamers |
| Digital Living |
| Virus & Spyware |
| Hardware |
| Software |
| ITPro |
| Developer |
| Storage |
| OS |
| Database |
| Security |
| Programming |
| Web Development |
| Networking |
| Other |
| Community Support |
| 02.11.2008 at 02:25AM PST, ID: 20865167 |
| 02.11.2008 at 03:00AM PST, ID: 20865308 |
| 02.11.2008 at 09:08PM PST, ID: 20872629 |
| 02.11.2008 at 09:53PM PST, ID: 20872756 |
| 02.11.2008 at 10:28PM PST, ID: 20872843 |
| 02.11.2008 at 10:32PM PST, ID: 20872854 |
| 02.11.2008 at 10:40PM PST, ID: 20872874 |
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: |
Imports System.Windows.Forms
Imports System.IO
Public Class MDI
Dim AR
Dim dTime As String, dDate As String
Dim BidQTY, AskQty As Double
Dim I As Integer
Public bMarketClosed As Boolean, bConnectionError As Boolean, iReconnectingTimes As Integer
Dim dtQuotes_Master As New DataTable
Public dsQuotes_Master As New DataSet
Public sXML_Quotes_Master As String = Application.StartupPath & "\quotes_master.xml"
Public bXML_Quotes_Master_Exists As Boolean
Private WithEvents wsClient As New SocketsClient()
Delegate Sub UpdateTextHandler(ByVal message As String)
Public Sub UpdateText(ByVal message As String)
Me.Text = message
End Sub
Delegate Sub OnFly_TS_DataArrival_Delegate(ByVal AR)
Public Sub OnFly_TS_DataArrival(ByVal AR)
OnFly_TS.DataArrival(AR)
End Sub
Delegate Sub OnFly_Q_DataArrival_Delegate(ByVal AR)
Public Sub OnFly_Q_DataArrival(ByVal AR)
OnFly_Q.DataArrival(AR)
End Sub
Delegate Sub OnFly_OB_DataArrival_Delegate(ByVal AR)
Public Sub OnFly_OB_DataArrival(ByVal AR)
OnFly_OB.DataArrival(AR)
End Sub
Private Sub Default_OnFly_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
With dtQuotes_Master
.Columns.Add(New DataColumn("Row", GetType(System.Double)))
.Columns.Add(New DataColumn("StockID", GetType(System.Double)))
.Columns.Add(New DataColumn("Stock_E", GetType(System.String)))
.Columns.Add(New DataColumn("Stock_A", GetType(System.String)))
End With
If File.Exists(sXML_Quotes_Master) Then
bXML_Quotes_Master_Exists = True
dsQuotes_Master.ReadXml(sXML_Quotes_Master)
Else
bXML_Quotes_Master_Exists = False
dsQuotes_Master.Tables.Add(dtQuotes_Master)
End If
With OnFly_TS
.MdiParent = Me
.Show()
End With
With OnFly_Q
.MdiParent = Me
.Show()
End With
With OnFly_OB
.MdiParent = Me
.Show()
End With
End Sub
Sub EJ_QuotesMaster_Refresh()
If File.Exists(sXML_Quotes_Master) Then
dsQuotes_Master.ReadXml(sXML_Quotes_Master)
End If
End Sub
Private Sub tmrFeed_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrFeed.Tick
iReconnectingTimes = iReconnectingTimes + 1
ReConnect(True, CStr(iReconnectingTimes))
End Sub
Sub ReConnect(ByVal bReconnecting As Boolean, Optional ByVal iCount As String = "")
Dim sText As String
If bReconnecting = True Then
sText = "Reconnecting"
Me.Winsock1.Close()
Else
sText = "Connecting"
End If
Me.Text = vbCrLf & _
"------------------------------------------------------------------------------" & _
vbCrLf & _
sText & " @ " & Now & _
vbCrLf & _
"------------------------------------------------------------------------------" & _
vbCrLf & _
Me.Text
wsClient.Connect("192.0.3.18", 5555)
End Sub
Private Sub wsClient_onConnect() Handles wsClient.onConnect
Me.tmrFeed.Enabled = False
iReconnectingTimes = 0
bConnectionError = False
End Sub
Private Sub wsClient_onDisconnect() Handles wsClient.onDisconnect
Me.tmrFeed.Enabled = True
End Sub
Private Sub wsClient_onDataArrival(ByVal Data() As Byte, ByVal TotalBytes As Integer) Handles wsClient.onDataArrival
Try
Dim sText As String = wsClient.BytestoString(Data)
Dim arCR
arCR = Split(sText, vbCrLf)
If Not (Trim(sText) = "" Or UBound(arCR) = 1) Then
For I = 0 To UBound(arCR) - 1
If (Trim(arCR(0)) <> "") And (Len(arCR(0)) > 1) Then
arCR(I) = Trim(Mid(Trim(arCR(I)), 1, Len(Trim(arCR(I))) - 2))
Dim displayText = IIf(bMarketClosed, "Market Closed", "Market Open") & " - " & arCR(I)
Me.Invoke(New UpdateTextHandler(AddressOf UpdateText), New Object() {displayText})
AR = Split(arCR(I), "|")
If UBound(AR) > 0 Then
Select Case AR(0)
Case "$MM"
If AR(3) = 4 Then
bMarketClosed = False
Else
bMarketClosed = True
End If
Case "$CH"
If AR(11) = 4 Then
bMarketClosed = False
Else
bMarketClosed = True
End If
Case "$LL"
'If dsQuotes_Master.Tables.Count = 1 Then ' to make sure it's not added more than 1 table
'If File.Exists(Me.sXML_Quotes_Master) Then
'If bXML_Quotes_Master_Exists Then
'>>>> Why do you need to check?? You have already added a table to the dataset!
Dim arRows() As DataRow = dsQuotes_Master.Tables(0).Select("ROW=" & Val(AR(2)))
If arRows.Length <> 0 Then dsQuotes_Master.Tables(0).Rows.Remove(arRows(0))
'End If
Dim Row1 As DataRow
'Row1 = dtQuotes_Master.NewRow()
Row1 = dsQuotes_Master.Tables(0).NewRow
Row1("Row") = AR(2)
Row1("StockID") = AR(3)
Row1("Stock_E") = AR(4)
Row1("Stock_A") = AR(5)
'dtQuotes_Master.Rows.Add(Row1)
dsQuotes_Master.Tables(0).Rows.Add(Row1)
'dsQuotes_Master.Tables.Add(dtQuotes_Master)
File.Delete(Me.sXML_Quotes_Master)
dsQuotes_Master.WriteXml(Me.sXML_Quotes_Master) '>>> You should not write the file on every hit PLUS need to delet existing as well
'dsQuotes_Master.Tables.Remove(dtQuotes_Master)
Case "$TT"
'Application.DoEvents()
'OnFly_TS.DataArrival(AR)
Me.Invoke(New OnFly_TS_DataArrival_Delegate(AddressOf OnFly_TS_DataArrival), New Object() {AR})
Case "$QQ"
'Application.DoEvents()
'OnFly_Q.DataArrival(AR)
Me.Invoke(New OnFly_Q_DataArrival_Delegate(AddressOf OnFly_Q_DataArrival), New Object() {AR})
Case "$XX"
'Application.DoEvents()
'OnFly_Q.DataArrival(AR)
Me.Invoke(New OnFly_Q_DataArrival_Delegate(AddressOf OnFly_Q_DataArrival), New Object() {AR})
Case "$KB"
If bMarketClosed Then Exit Select
'OnFly_OB.DataArrival(AR)
Me.Invoke(New OnFly_OB_DataArrival_Delegate(AddressOf OnFly_OB_DataArrival), New Object() {AR})
Case "$KS"
If bMarketClosed Then Exit Select
'OnFly_OB.DataArrival(AR)
Me.Invoke(New OnFly_OB_DataArrival_Delegate(AddressOf OnFly_OB_DataArrival), New Object() {AR})
End Select
End If
End If
Next
End If
Catch ex As Exception
Text = ex.Message
End Try
End Sub
End Class
|
| 02.11.2008 at 11:18PM PST, ID: 20872961 |
| 02.12.2008 at 12:25AM PST, ID: 20873169 |
| 02.12.2008 at 01:21AM PST, ID: 20873394 |
| 02.12.2008 at 01:59AM PST, ID: 20873560 |
| 02.12.2008 at 02:53AM PST, ID: 20873817 |
| 02.12.2008 at 11:27PM PST, ID: 20882308 |
| 02.13.2008 at 12:09AM PST, ID: 20882455 |
| 02.13.2008 at 01:33AM PST, ID: 20882815 |
| 02.13.2008 at 02:53AM PST, ID: 20883101 |
| 02.13.2008 at 02:13PM PST, ID: 20888905 |
| 02.13.2008 at 09:16PM PST, ID: 20891089 |