473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Getting little square characters instead of Text

I am sending SNMP SystemName query to local host and in response i m getting little square characters instead of the specific system name..

Expand|Select|Wrap|Line Numbers
  1. Imports System.Text
  2.  
  3. Class Form1
  4.  
  5.     Dim commlength As Integer, miblength As Integer, datatype As Integer, datalength As Integer, datastart As Integer
  6.     Dim uptime As Integer
  7.     Dim output As String
  8.     Dim conn As New SNMP()
  9.     Dim response As Byte() = New Byte(1023) {}
  10.     'Public Shared Sub Main(ByVal argv As String())
  11.     'End Sub
  12.  
  13.  
  14.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  15.         IPaddress.Text = "115.186.115.188"
  16.         Community.Text = "public"
  17.  
  18.     End Sub
  19.  
  20.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  21.  
  22.         ListBox1.Items.Add("Device SNMP information:")
  23.  
  24.         ' Send sysName SNMP request
  25.         response = conn.[get]("get", IPaddress.Text, Community.Text, "1.3.6.1.2.1.1.5.0")
  26.         If response(0) = &HFF Then
  27.             ListBox1.Items.Add("No response from " & IPaddress.Text)
  28.             Return
  29.         End If
  30.  
  31.         ' If response, get the community name and MIB lengths
  32.         commlength = Convert.ToInt16(response(6))
  33.         miblength = Convert.ToInt16(response(23 + commlength))
  34.  
  35.         ' Extract the MIB data from the SNMP response
  36.         datatype = Convert.ToInt16(response(24 + commlength + miblength))
  37.         datalength = Convert.ToInt16(response(25 + commlength + miblength))
  38.         datastart = 26 + commlength + miblength
  39.         output = Encoding.ASCII.GetString(response, datastart, datalength)
  40.         ListBox1.Items.Add("  sysName - Datatype:" & datatype & "," & output)
And this is the output m getting

Device SNMP Information:

sysName - Datatype: 48, [][][][]
Oct 9 '11 #1
1 2485
Rabbit
12,516 Expert Mod 8TB
I don't know what SNMP is but are you sure the data is ASCII encoded? Those square boxes that are displayed are usually because the data contains undisplayable characters. This means one of two things, either it uses a different character encoding scheme or the data is binary. In the former case, you will have to use the correct encoding. In the latter case, you should display it as hex.
Oct 9 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: alcesteatxmissiondot | last post by:
I have a table with a couple of TEXT columns. In one of them, there are characters that aren't supported by the application and don't seem to be able to display in the Query Analyzer either. I...
2
by: Andrew | last post by:
Hi, I have a form set up which collects details and then when submitted it creates a new record in a table called rbh_vacancies Most of the time it adds the records perfectly, but there seems...
1
by: Steve | last post by:
Hello, I'm running into a problems with a non-ascii "character" in a text string. Im parsing character by character and all lines end with ascii 13 & 10 (Carriage return & newline). I'm encoding...
4
by: Jean | last post by:
Hi all, I have a function in VB that reads values in a text file on my hard drive, and returns the value read as a String. However, when I check the value in the locals window of the VBE, it...
1
by: MLH | last post by:
The text below was cut 'n past from an HTML file. When I pasted it into a text field of an Access 97 table, it looked different than it does below. Below, you can see that the first 3 lines have...
3
by: JSM | last post by:
Hi, I am just trying to port an existing simple encryption routine to C#. this routine simply adds/substracts 10 ascii characters to each character in a text file (except quotes). The routine...
0
by: Jerry | last post by:
Getting the Width of a Text in Web Like this: dim x as integer len = GetTheLength("MyBlaBla") I try to do it this way with a Label but after a view thimes runnig the
2
by: brian | last post by:
I am building a form and need for the customer to be able to enter a return character. Does ASP.NET have a control that is similiar to the HTML TEXTAREA control? Or is there another control that...
0
by: abcd | last post by:
I have a wxTextCtrl: wx.TextCtrl(self.myPanel, -1, "", style=wx.TE_MULTILINE) I take a set of text (65,000 characters), and paste it into the text control. all looks well. Then when I click...
2
by: jyck91 | last post by:
i have done the magic square: #include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 13 main() { FILE *fp; int i, j, n, row, column;
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.