Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Sending And Receiving Data Through TCP/IP


hi members, I wana send and receive data through TCP/IP. i m knew with winsock. so, please if some one have sample code then i will be really thankfull.
waiting 4 quick response. i need it urgent




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Sending/receiving Data
How can you receive files or send files to diferent machines? Is there some command in winsock that helps you achieve this? Do you know some code for this? or even a web-site that explains this? If you do know some info then do tell me...

thankyou very much

magicbeans14

Sending And Receiving Data For A Game
I'm working on a simple round to round based game (kind of like turn based but not quite). I'm just learning the winsock control and I've learned a good portion, such as setting up the tcp/ip connection and sending and receiving data. So now comes my next problem. Here's the game code will work:

The game has the code for both host and client. During the starting of the game, the host has randomize variables for the 30 planets, and then send all that information to the client. So it looks like this: (planets is a user defined variable type i have to contain each planet data in an array. stargrid is an image array, 0 to 109, on form1.)


Code:
For a = 0 To 29

If host = True Or p2player = True Then

Randomize
Do
b = Int(Rnd * 109)
Loop Until planets(b).exists = False

Dim conArmy As Integer
Dim conRegen As Integer
conArmy = Int(Rnd * 45) + 15
conRegen = Int(Rnd * 20) + 7

End If

planets(b).exists = True
planets(b).grid = b
stargrid(b).Visible = True
stargrid(b).Picture = neutralplanet.Picture
planets(b).regen = conRegen
planets(b).army = conArmy
planets(b).temparmy = planets(b).army
planets(b).owner = "Neutral"

Next a

The IF section is the part that the host has to randomize for each planet. After that, it just sets the variables with the info. What i need to do is send those variables to the client. But when i send the data and receive the data on the client side, it sends so fast that the buffer contains the last variable and the client sets all the variables to the last variable isntead of getting the data seperately each time. (i hope that made sense). What i have set is an IF statement. If host = true, then it sends all the data seperately using functions i wrote. If client = true, then its set to receive the data using another function. And here they are.


Code:
Public Sub Winsock_DataArrival(ByVal bytesTotal As Long)
Winsock.GetData incdata
receiving = True
End Sub

Private Sub Winsock_SendComplete()
sendcomplete = True
End Sub

Public Sub Gsenddata1 (data1)
sendcomplete = False
Winsock.SendData data1
Waiting.Show
Do
DoEvents
Loop Until sendcomplete = True
Unload Waiting
End Sub

Public Sub Ggetdata1()
Do
DoEvents
Loop Until receiving = True
End Sub

I know my explanation might be alittle confusing.. I'm hoping someone can help me figure out a way to seperate the sends and receives? My only idea so far is to create another array that contains the incdata variable, and will have to make that work somehow, lol.

[VB6] Sending And Receiving Data With Winsock
I want to make a simple program that will be able to send and receive text messages and files by communicating with same program that is running on different PC. It will use TCP/IP connection.

Is it possible to make it with Winsock, and if it is, could someone explain to me or give me a link to a good tutorial for this.

Edit: And one more thing.- I have red that for small amounts of data, UDP protocol is used. So if i only want to send messages, is it better to use UDP protocol instead of TCP?

Receiving And Sending Complicated Data
I'll explain this as much as I can...
I need to grab data from an Xbox and send it to a remote computer, which will inject the data into another Xbox
I will be using PacketX(http://www.beesync.com) for this
This is one of the packets (or data from the Xbox)
In Hex:

Code:
FFFFFFFFFFFF0050F24AE6BF080045000045F6D50000401183D200000001FFFFFFFF0C020C020031E97D480000000C620BD34081D5BB4E40BA7762EF70436400534D03050000020F598810CBF9D21B2B05F96A


for faster transfer of this packet to the remote computer, I change it into ASCII with a function hex2ascii(...) making the length of the packet half as much

This is what I need to do....
Now, when recieving the packet, I need to change it back to hex and put each of them into an array
ex..

Code:
Array(&hFF, &hFF, &hFF, &hFF, &hFF, &hFF, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, _
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, _
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00)

http://beesync.com/packetx/docs/html...apter.html#a28

then send them to the Xbox by using that array

I've tried various ways, but none of them have worked

Sending/receiving Data With Multiple Connections
Hello, this is not really a Winsock question, but I need to send/receive data with multiple connections and I'm not really sure how to do this. It's a bit complicated, but I'll try to explain it the best I can.

I have several items in a Listview. To each Listview item belongs a Collection with strings (between 1 and 300). I need to send each string in the first Collection to the server and the server automatically sends data back. This needs to be done with multiple connections.

After all the strings from the first collection have been sent to the server and all the data the server has sent back is received, then the item in the Listview has to be removed.

Then all the strings from the second collection have to be send to the server. After all the strings from the second collection have been sent to the server and all the data the server has sent back is received, then that item in the Listview has to be removed... etc, etc, until the end of the Listview.

Below is some pseudo code. I'm specifically having problems with the "DownloadNextPart" sub.


Code:
Option Explicit

Private col(1 To 5) As Collection
Private strData(1 To 4) As String
Private BufferData(1 To 4) As String

Private Sub Form_Load()
Dim i As Integer, x As Integer

For i = 1 To 5
lvwItems.ListItems.Add , , "Item in Listview: " & i 'several items in the listview

'add strings to the Collections (just an example)
Set col(i) = New Collection
For x = 1 To 50
col(i).Add "string to send to the server"
Next x

Next i

End Sub

Private Sub Command1_Click()
Dim i As Integer

For i = 1 To 4 '4 connections to the server
Sockets(i).Close
Sockets(i).Connect "someserver.com", 80
Next i

End Sub

Private Sub Sockets_Connect(Index As Integer)

Call DownloadNextPart(Index) 'start downloading when connected to the server

End Sub

'I'm not sure how to make this work properly
'????
Private Sub DownloadNextPart(Index As Integer)
Dim i As Long

With lvwItems
For i = 1 To .ListItems.Count 'loop through listview items

If Sockets(Index).State = sckConnected Then

'send next string in collection
'if there are no more strings to be sent from a collection then
'start sending strings from the next collection ????
Sockets(Index).SendData col(.ListItems(i).Tag).Item(???????) & vbCrLf

Exit Sub
End If

Next i
End With

End Sub

Private Sub Sockets_DataArrival(Index As Integer, ByVal bytesTotal As Long)

Sockets(Index).GetData strData(Index), vbString 'get data

BufferData(Index) = BufferData(Index) & strData(Index) 'buffer data


If InStr(1, BufferData(Index), "...") Then ' all data has been received
'do something with it

BufferData(Index) = vbNullString 'clear buffer
End If

'if this is the returned data from the last string
'in the collection, then remove Listview item ?????

Call DownloadNextPart(Index) 'download next part
End Sub

Mscomm Control - Sending /receiving Data To/from Serial Port (com1)
I'm a newbie using Mscomm control..
I'm not able to send /receive data to/from the Serial port i.e. com1 using mscomm control....
Correct me if i'm wrong...the code is as follows

VB Code:
Option Explicit Private dummy As String Private Sub MDIForm_Load()        ' handle the error if the comm port doesn't exsist    On Error GoTo err_handler        ' open both the send and recv form    frmSend.Show    frmRecv.Show        ' test to see if the comm port is already open    If MSComm1.PortOpen = False Then MSComm1.PortOpen = True        Exit Sub    err_handler:    'in case the comm port does not exsist    If Err.Number = 8002 Then MsgBox Err.Number & " : " & Err.Description, vbOKOnly, App.Title    frmSend.cmdSend.Enabled = False    End Sub Private Sub MDIForm_Unload(Cancel As Integer)        ' close the comm port if it is open    If MSComm1.PortOpen = True Then MSComm1.PortOpen = False    End Sub Private Sub MSComm1_OnComm()        Dim pos As Integer        ' test to see if we recv'd data    If MSComm1.CommEvent = comEvReceive Then                ' move the data from the input buffer into a variable        ' keep adding the data as it comes in to the variable        dummy = dummy & MSComm1.Input                ' test to see if we have gottn everything        pos = InStr(dummy, vbCrLf)        If pos > 0 Then                        ' add the data to the list box            frmRecv.lstData.AddItem Left(dummy, pos - 1)                        ' clear out the variable            dummy = ""        End If    End If    End Sub Private Sub cmdSend_Click()    ' test to make sure something was entered into the textbox    If Len(txtMessage.Text) = 0 Then Exit Sub        ' send the message out the comm port    mdiMain.MSComm1.Output = txtMessage.Text & vbCrLf        ' clear the sent message from the text box    txtMessage.Text = ""    End Sub

Sending And Receiving SMS
Hai everybody,
I intend to write a small application, to receive and send SMS, which inturn interacts with SQL server. Please help me to how to start and what are the security problems if i use any remote server.

Thanks
Viju

Help On Sending And Receiving
Hi i was wondering if it is possible to see what the USB Port is send and receiving? if so could someone post an example code?

Sending And Receiving SMS
I'm currently working on a project dealing with SMS.

I intend to engage in a 'chat-style' conversation with the modem. However, I'm not sure if the modem will be able to reply me. Are there any codes to make this work?

Sending And Receiving E-mail
I need to know how to send an e-mail from my VB6 program, and how to receive an e-mail, and place its contents into a variable. I've searched this thread and have had no luck implimenting any of the routines described here.

CDO The simplest seemed like using CDO, but I have Win XP my references list only contains CDO for Windows 2000, and if I try it anyway, VB crashes and closes.

SMPT. I followed these instructions:
Installation

for use with Visual Basic 6 (any edition):
1. download smtp_component.zip
2. unzip OSSMTP.dll from it to Windows System directory
3. run "regsvr32 OSSMTP.dll" from command-line

I don't know what "from command-line" means (dos perhaps?), but I press the Windows button + R to get the Run Dialog box. Then I typed "regsvr32 OSSMPT.dll and pressed OK. It told me the installation was a success.

I downloaded a zip that had a sample .vbp from http://www.winsockvb.com/
I put my own e-mail address after the = in the ".MailTo =" line. The first time I ran it, it locked up VB and I had to control+alt+delete to exit. The next time I tried it, it didn't crash, but there was no e-mail in my mailbox.

Any help would be appreciated.

**** edit ****
I kinda got it to work, but I had to make up a hotmail account. If I send mail to my new hotmail account, the program seems to work OK, except the e-mail doesn't show up in my mailbox. If I send to my other e-mail address, it tells me invalid address for an address that I know to be valid.

It gives me this:

Quote:





220 mc9-f12.hotmail.com Microsoft ESMTP MAIL Service, Version: 5.0.2195.6824 ready at Thu, 8 Jul 2004 18:12:56 -0700
HELO mail.hotmail.com
250 mc9-f12.hotmail.com Hello [64.171.5.117]
MAIL FROM:tony@gravitysimulator.com
250 tony@gravitysimulator.com....Sender OK
RCPT TO:gravitysimulator9@hotmail.com
250 gravitysimulator9@hotmail.com
DATA
354 Please start mail input.
BCC:
CCC:
SUBJECT:Test mail from WinsockVB.com control
TO:You
FROM:Me

Hello
.
250 Mail queued for delivery.
QUIT
221 Closing connection. Good bye.




Everything here looks good, but I get no e-mails sent to my hotmail account.

When I change to the mail server for my other e-mail address, I get this:

Quote:




220 pop.directnic.com ESMTP
HELO pop.directnic.com
250 pop.directnic.com
MAIL FROM:tony@gravitysimulator.com
501 5.5.4 Syntax error in parameters or arguments

Sending And Receiving Speech
Hello, I thought I remembered someone asking this question awhile back but couldn't find it. Anyways, I was wondering if someone could point me to somewhere where I can learn to make it so that people can send and receive the sounds that people are saying. For example

My Computer: Through my microphone I say "Hello"
Some other computer: Receives the "Hello" through his speakers. and says "Hello" back
My Computer: I receive what he says.

Any help would be great!

Sending And Receiving Files...
Im wondering the commands for winsock and other things I need to use for being able to send and recive files...

Kinda like an aim dirrect connection...but with my own program.

Also if you have a basic program already made can I see your code so I can base my code off yours and see how it all works together?

Thanks in advance,

-- Paul

Sms Sending And Receiving Using Mscomm.. Help..
hi! gud day..

currently, im developing a sms application using VB6 (mscomm) and AT commands, w/ my 6210 and datacable(DLR-3P)..

i have already tested (AT commands) and tried sending/ receiving sms using hyperterminal, and it works..then wrote i have found a code (below; similar to the AT commands i have tested in hyperterminal) from the net, and pasted to my form;
changed a few (TEXT BOXES, for the mesg and the recipients number); however why it seems, it dosen't work, when i run (F5) the program; but when i try to debug it (F8) it do works, and i was able to send mesgs..im sure that i didnt worked since, i checked my phone credit (load) everytym i test the program, and nothing was subracted.. is there a problem with the code?

second, is there a way i can see in VB the values "error", "ok", "+cmgs:321"; the reponses of the modem after an command is executed, like when i test it to hyperterminal.. i would like to do some error trapping with that, and eventually put a alerts like "message failed" or "message sent".. bcoz when i run this code, i have to look at my phone, and all it says is "terminal connection interrupted", i couldnt tell if the mesg was sent or an error has occured..

third, im also programming the receive module of this program.. what i did was to modify some of the codes of sending sms..
(also see below).. i have tested the AT commands, and it works with hypertermnial.. but, my 3rd problem is, i dont know what to do next.. i have reading some threads of placing an code in commEventRecv.. i hav tried dat, but still it dosent seem to work..

can anyone help me with these.. pls.. i really need it for my project w/c is due less than 2 weeks.. please..

im really sorry, im new with mobile programming... and i had to jump start to AT commands, since it is a prequisite of my project (that the program that i will develope should be scalable to gsm modems; kinda plug and play concept)..


thank u to all.. i appreciate ur time of reading this on, andd all the suggetions, the help u culd give..

thanks u very much..

happy holidays!!

- mauve

----------
SENDING SMS (i dont know where/what is the problem)


Private Sub cmdSendMesg_Click()
' Set up the communications port
MSComm1.CommPort = 1 ' Com Port 1

' Set for 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"

' Tell the control to read entire buffer when Input is used
MSComm1.InputLen = 0

' Open the port
MSComm1.PortOpen = True

' Send an 'AT' command to the phone
MSComm1.Output = "AT" & Chr$(13)
' The phone will respond with an 'OK'

' Set up the phone for a text message
MSComm1.Output = "AT+CMGF=1" & Chr$(13)
' The phone will respond with an 'OK'

' Prep for SMS, give destination type and destination address.
' Enter the destination type and destination address to prep for SMS
' txtRecpMobileNo.Text whre the sender number will be, it is always placed with a plus sign (+) first, beofre the no is typed.. no spaces..

MSComm1.Output = "AT+CMGS= " & Chr(34) & txtRecpMobileNo.Text & Chr(34) & Chr$(13) & Chr(10)


' txtMesg.Text - is the mesg

MSComm1.Output = txtMesg.Text & Chr$(26)


' Close the port
MSComm1.PortOpen = False

End Sub



-----------------
RECEIVEING SMS

Private Sub cmdSendMesg_Click()
' Set up the communications port
MSComm1.CommPort = 1 ' Com Port 1

' Set for 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"

' Tell the control to read entire buffer when Input is used
MSComm1.InputLen = 0

' Open the port
MSComm1.PortOpen = True

' Send an 'AT' command to the phone
MSComm1.Output = "AT" & Chr$(13)
' The phone will respond with an 'OK'

' Set up the phone for a text message
MSComm1.Output = "AT+CMGF=1" & Chr$(13)
' The phone will respond with an 'OK'

' new mesg indication automatically send to pc, and not saved new mesg to sim/phone memory
MSComm1.Output = "AT+CNMI=1,2,0,0,0 " & Chr$(13)

(THIS IS WHERE I AM STUCK; dont know what to write next..)


' Close the port
MSComm1.PortOpen = False

End Sub

Sending To And Receiving From Com Port
Hello to everybody!!!

I need some help . I need some sample code to send some data to com port and to receive data from it. I also need how to set com port open/close/wait untill some data is receive from com port etc...

Thx to every1...

Sending And Receiving Packets.. Help!
Well I need major help.. could someone maybe direct me to a program that could record packets beign sent and received from a program.. also is there any tutroails on sendinf and understanding packets?


I am trying to fake a game client..

Sending And Receiving Variables
Hi, i've got a big Problem:

I have to work out a Programm:

Sending 5 Variables (integer) and receiving 2 Variables from Remotecontroll.

The Server receives this 5 Variables ans sends other 2 Variables.

How's that possible!

Vb6 Sending And Receiving Problem
Hi all,

How can i send binary or hexadecimal or decimal data from PIC16F876 to visual basic 6 and display the value in text? what code should i use in vb to receive and display it?
by the way, can the vb6 display the word "hello" from PIC16F876? what is the coding in vb6?

thanks

Sending/receiving Info Across The Net
Hi.

Simply question really but im ever so confused.

Lets say i had a piece of script on my webserver which basically sends a response back when it gets the command "hello".

How might i go about making a vb app which conects to this script,sends the command and then recieves the response from the script??

Ps the example above is fictious so please dont ask my any info on scripts etc cas i dont know anything about them, im mostly interested in the vb app and how it does its job.

Thanks a bunch

Sending And Receiving Email With VB/VBA
I want to write a simple application that runs on my PC at home. I want it to do two things.

1) Periodically check a given email account on a POP3 server, write the email information (from, time, subj, text) to a text file, and delete the message from the server.

2) Periodically check a given directory on my hard drive, take the files that it finds there and send them via email to the address specified in the file.

The file handling and parsing I know how to do, integrating the email is trickier because I really don't know much about it. The system has Outlook Express installed and that is the mail client I want to continue using.

Any help would be appreciated.

Bob

Receiving (and Sending) Faxes In VB - Is It Possible????
Hi!

Does anyone have any idea how to solve fax receiving in VB?? I can handle sending, but I don't have a clue how to implement receiving. I couldn't found any information about this on internet (at least not useful one), so I'm sure it's possible, but HOW? Maybe some already made code?

Thanx for anykind of information in advance !!

Sending && Receiving Mails Through VB
hi all,
i have attached a small project for sending mails through VB..can anyone help me so that i can also receive mails with this program..I lost touch with vb for a very long time and it would be really helpful if anyone could help me out..

Serge, Mark Sreeves, Yonatan..are u guys there??

Receiving/Sending E-Mail Through VB6?
Hello everyone,

I'm creating a basic remote-control application.  The server runs on my machine, then I can send some commands from my mobile phone (via email, hopefully) to my server machine to perform various functions.

Is it possible to send and receive email using VB6?  I'm broke, so I can't pay for any professional solutions.

Thanks for your help,

PulsarSL

Server Sending && Receiving
I am new to writing client-server programs and i am having a problem getting my server program to send as well as receive on one port. I know it is something simple.  I even took out all the added stuff my program does to boil it down to the basics to test it.  But it still didnt work.  
Here is my test code:

Server side:

Private Sub Set_to_Listen_Click()
Winsock1.LocalPort = 8866
Winsock1.Listen
End Sub

Private Sub Send_to_Client_Click()
Dim buffer(0 To 2) As Byte
buffer(0) = 1
buffer(1) = 1
buffer(2) = 1

Winsock1.SendData buffer
End Sub

Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
Winsock1.Accept requestID
MsgBox "connected"
End Sub



Client Side:

Private Sub Listen_for_Server_Click()
Winsock1.LocalPort = 8866
Winsock1.Listen
End Sub

Private Sub Establish_Connection_Click()
If Winsock1.State <> sckClosed Then
Winsock1.Close
End If
Winsock1.RemoteHost = "1.2.1.111"
Winsock1.RemotePort = 8866
Winsock1.Connect
End Sub


Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim sData(0 To 2) As Byte
MsgBox "freceived"
Winsock1.GetData sData, vbArray + vbByte '1

End Sub


The server hits the "set_to_listen" button, then the client hits the "establish_connection" button.  Once that is done the client hits the "listen_for_server" button and the server sends the data over.  At this point i get "Wrong protocol or connection state for the requested transaction or request" error.

I am using 2 computers and if i can get this test working i think i can get my larger program working.

Thanks in advance, i've been pulling my hair out.

Serial Communications: Sending And Receiving
Hello,

I'm currently writing a VB program to send and receive data out of the serial port using the MSComm component to a chip tester. My question is, is it possible to send data out of Comm1 and to receive data in from Comm2 from a SINGLE computer or do I need 2 computers?

I have tried using 1 computer and have connected the pins on comm1 and comm2 as following:

Comm1 - Comm2
---------------------
2 - 3
3 - 2
5 - 5

At the moment, I was able to send data out of comm1 but am receiving nothing in my display text box. It is not possible that the input buffer is empty so I suspect that something is wrong with my code.

Please help!!

Sending/receiving File Through MCsomm
is there a protocol or made ready code for sending and receiving files using Mscomm.osx? ive tried a sending code but it does not seem to send it properly, and displays the content of the file in words. moreover, it only displays part of it. any help would be great!

Thanx

Sending And Receiving Sms (cellphone Connected To Pc) Vb6
hello everybody, im lynard. i just want to know how can i send and receive sms using my cellphone connected to my pc. i have already the mbus cable and its working perfectly when i installed the nokia logo manager. is there any code in vb6? im using only 5110 as my expirement phone, very cheap.hehe.

Send/recv = Not Sending Or Receiving
VB Code:
Dim user1 As Stringuser1 = "kkkkk" Dim buf10 As Stringbuf10 = String(32, 0) sendString lngSocket, user1, Len(user1), 0recvString lngSocket, buf10, Len(buf10), 0If Left$(buf10, 4) = "blah" Then    MsgBox "ok...", vbCritical    Unload MeElseIf Left$(buf10, 5) = "blahh" Then[b]sendString lngSocket, hd2, Len(hd2), 0recvString lngSocket, buf10, Len(buf10), 0ElseIf Left$(buf10, 4) = "blap" Then    MsgBox "good"    Unload MeElseIf Left$(buf10, 5) = "blump" Then    MsgBox "Everything works..."End If[/b]

The code you see in bold doesn't work. The code above it works fine. So I take it you can't send/recv data 2 times each in the same function? or?

Any problems with any of this?

Sending/Receiving Binary Files
I was wondering if anybody would have any example code on how to send/receive binary files.
I've been trying to do this for awhile and have yet to be successful at it....

Any help would me much appreciated

Sending And Receiving Binary Through MS Outlook
I'm working on an application to read e-mail.
I have a different platform sending data through email and to conserve space I am sending the data in binary. My biggest problem is that certain charactors are used by Outlook as control codes and Outlook manipulates the data.

Does anyone know of a methode of temprarily "turning off" Outlook's response to control charactors? If not does anyone know of a email program that will do this?

I've thought of sending the data as an attachment but I beleive that too adds a lot of data to my message. I am very limited on the amount of space each message can contain, I beleive it's 104 bytes, so I would like to get as much data as possible without using up space for control codes.
For referance here are the ascii codes that I cannot receive correctly;
00, 10-13, 145-151, 160, 173.
I know what some of these control codes are, so I know what Outlook is trying to do, but that doesn't help me to receive them.
With a VB application I can create a file with codes 0-256 and read the file back correctly so I am pretty sure it is the email system that is createing the problem.

Sending And Receiving Messages From VB Using GSM Modem
Hi to all,

Anyone knows how to sending and receiving messages from VB using GSM Modem?
Please help me about this..



Thanks a lot.
Joseph

Sending & Receiving Winpopup Msgs
I need to write a Visual Basic Winpopup class (DLL), so that I can send and receive Winpopups from ASPs, VB Apps etc.  My DLL must work with existing Winpopup users so writing a Winsock Server/Client program is no good. I don't want to use third party products.  Could someone please tell me how I can Send/Receive winpopup messages.

Sending From MSComm And Receiving From Winsock (VB)
hi all,

i am trying to send a text file through mscomm control to a device (MCU). the device then sends the text file back to the ethernet card. here i have used winsock control to receive data.

when i send data through winsock and receive in com port the text file receives properly, but when i send file through com port and receive through ethernet the text file is garbled. the code works partly for Unicode files but returns only garbled characters for ANSI file.

receiving through com port

Code:If link.PortOpen = True Then

    Select Case link.CommEvent
    Case comEvReceive
        'link.InputLen = 0
        If Ret1 = 5 Then
            'Open temp1 For Output As hLogFile
            Buffer = link.Input
            ShowData hidden, (StrConv(Buffer, vbUnicode))
        Else
            Buffer = link.Input
            'Debug.Print "Recv : " StrConv(Buffer, vbUnicode)
            ShowData rstext, (StrConv(Buffer, vbUnicode))
        End If
    End Select
    
End If


receiving through ethernet

Code:If term.State = sckConnected Then

If Ret1 = 5 Then
    
    term.GetData Buffer
    ShowData hidden, (StrConv(Buffer, vbUnicode))

Else
    term.GetData Buffer
    'Debug.Print "Recv : " StrConv(Buffer, vbUnicode)
    ShowData rstext, (StrConv(Buffer, vbUnicode))
    
End If
End If

i store the data temporarily in a textbox and then save it to a file when a button is clicked



Edited by - vin82 on 5/8/2004 2:25:53 AM

Sending And Receiving SNAP/Ethernet Packets
I am using VB6 and I want to send a SNAP packet (802.2) to a defined desitination (MAC address). My question is simple: how do I accomplish this?

A SNAP (Sub-Network Access Protocol) packet looks almost like an ethernet packet. If I am correct, this protocol is located below the TCP/IP stack. I have browsed the Internet for a solution and what I found was that I should use the WinSock Control and set the type of the socket to SOCK_RAW (raw socket). This, however, is not possible; the type can only be initialized with TCP or UDP. When using the Winsock Win32 API I can create a raw socket. But when I examine some sample code I somehow have the feeling that I am still on top of a TCP/IP stack because they require for instance an IP destination address.

Ok, attempt number 2 concerns WMI. I saw that when using WMI I can query my computer what NICs I have (I have a wired and a wireless NIC). But I am wondering if I can address a NIC and send a packet to it which the NIC will handle properly. I haven't found any interface to the WMI-COM to do this.

Again, what I want is this:
1) create/define a packet and initialize all required fields like MAC destination and source address.
2) present the packet to the ethernet driver (directly or indirectly?!?) to transmit the packet.
3) configure a listener for any receiving packets.

Can somebody help me with this problem; any link to sample source code will be very appreciated.

Using Mapi Controls For Sending And Receiving E-mails
hello!!!

i developed an application using mapi controls in order to send and receive emails using outlook express....

the application seemd to work fine with outlook express version 5.
But coming to version-6, itzz unable to connect...

is it that the available mapi controls r not compliant with the latest version...

pplzz help me in this regard......

thanking u, peri

Sending And Receiving Emulated Signals By Mscomm
Hi People, i would like to learn to transfer more than 3 diferents emulated analog signals (given by scrolls) from a pc to another one using mscomm, i tryied but i did not get what was wrong, or if it was my pc. THANX

Sending And Receiving Email Via Outlook Express
I have written code to send email with CDO (See following code).
Can you help me to have code to receive email with CDO Object?

Regards
Michael

Public Function SendEMail_CDO(strFrom, strTo, strCC, strSubject, strBody)
On Error GoTo ErrorHandling

Dim mail
Dim config
Dim fields

Set mail = CreateObject("CDO.Message")
Set config = CreateObject("CDO.Configuration")
Set fields = config.fields
Const cdoSendUsingPort = 25


' Set the CDOSYS configuration fields to use port 25 on the SMTP server.


With fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 '2 ' SMTP SERVER
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gawab.com"
.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "userName"
.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password"
.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = True
.item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10

.Update
End With

Set mail.Configuration = config

With mail
.From = strFrom
.To = strTo
'.cc = strCC
.Subject = strSubject
.TextBody = strBody
.Send
End With

Set mail = Nothing
Set fields = Nothing
Set config = Nothing

Exit Function
ErrorHandling:
Debug.Print Err.Description & " " & Err.Number

End Function


Michael Sakellis
Athens-Greece

Receiving/sending Emails With Attachments Through VB Code
Hi,

I am beginner. But I would like to know as to how we can write an application in VB 6.0 that receives/sends emails with attachments. Can you please send me the code to my email Id ramanavenkata@netscape.net

Ramana

Usin Winsock Sending And Receiving Over Multiple Forms
Using 2 forms (one to conenct host and client and one for the actual game), I tried to receive integer data with the:


Code:
winsock.getdata intOnline

then i tried to put the form with winsock in there:


Code:
frmConnection.winsock.getdata intOnline
but it still wouldnt work, is there something i have to do?

Receiving And Sending Message Using Cellphone To Pc Or Vice Versa...
i will be creating a program where i can send or receive text message or call from cellphone to pc, or vice versa... i will be using visual basic and (they say) the GSM technology...

can anybody help me with this? or can anybody give me a sample program?
i need this badly.. thanks..

Receiving Data
hi,
can somebody tell me please:how can receive a text file from, lets say, board?

Receiving Data From Com 2!
I am trying to use a weightbridge system, that connects to com2 at 4800bps, even parity, 7 bit
data, 1 stop bit and hardware flow control (4800,e,7,1,r) and the
incoming data is in the format:

3 39840 kg 13

( weight ID of weighing)

I don't know what the 3 is for.

The data is sent when the record printer prints (IE: when print is
pressed on the display unit)

How can i make the ID and Weight appear in fields on a form in access when the data is sent? I'd very much appreciate any help.

Thanks,

Dan

Receiving Data From A DLL
I have two ActiveX DLLs. Let's say ActiveX part1 calls ActiveX part2. As soon as ActiveX part2 is finished, it returns a string to ActiveX part1. How can this be done?? do I need the GetObject function?

in ActiveX part1, I know that I can use the CreateObject function and Class function to show the form in ActiveX part2.

How To Know If Mscomm Receiving Data???
I am connection three push button sending different data in to computer. I had use hyperteminal to check and the computer did receive the data. How am I going to know if VB mscomm is receiving the data??? And how am I suppose to link it with my program?

Receiving Data In With Winsock
If I use the Data receive Event in Winsock to get the data from the buffer how do I ensure that I have finished receiving all the data before I get it??

And if I count the bytes and it is not all there should i re-send and receive on the same connection or should i close that connection and make a new one??

I am writing a program that connects with a machine tcp/ip sends a command to it, and the machine sends back data. I seem to be getting the data before i have received it all, because if i step through 1 line of code at a time my program works correctly if I run it flat out, i never get the correct amount of data.

Thanks to anyone that can help
Carloski

Receiving Data Porblem
I'm trying to receive data from COMM Port and I use MSComm control. Parameters for MSComm1 are set as follows:

Port1
InBufferSize 0
InputMode comInputModeBinary

I expect to receive a variant form MSComm1.Input and to convert this into array of bytes. Code sample is:

Dim buffer() as Byte
ReDim buffer(1024)
buffer()=MSComm1.Input

Using debug mode and watches I realized that InBufferCount property keeps value (for exmpl.) 23 for a few seconds and then switches to zero without moving execution to next line of code. If I move execution to next line value is set to zero immediately.
I want to see results in TextBox or in debug window but I don't know h

How To Store The Receiving Data?
hi everyone,
im facing the problem with keeping the data from what i had send. now my data is continuous sending to my vb from time to time. so i need to store the previous data and compare it to the new data that i received.what code should i use to store my data as my data is keep on changing?

can anyone help me?
thanks.

Receiving Data From Satellite?
hello...

can anybody tell me how to retrieve/receive data from a satellite?
i'd be using visual basic 6...

[Winsock] Receiving Data
VB Code:
Dim user1 As Stringuser1 = txtuser.Text sendString Socket, user1, Len(user1), 0 Dim buf2 As Stringbuf2 = String(32, 0) recvString Socket, buf2, Len(buf2), 0 If buf2 = "userno"   MsgBox "user not in database"Else   MsgBox "user is in database"End If' i've even tried this:If buf2 = "userno" Then   MsgBox "user not in database"ElseIf buf2 = "useryes" Then   MsgBox "user is in database"End If

I can't figure out what's wrong. Been working no this matter for endless hours literally. For gods sake I need help

Copyright 2005-08 www.BigResource.com, All rights reserved