Client/Server using TCP/IP with Winsock....
I have a question if I want to send a multiple text boxes from client program to the server program, how can I do that?
For example, I have 5 text boxes in a client program named, txtIP, txtPort, txtFirstName, txtLastName, and txtTitle. I want to send all of them to the server program and let the server program show the same text boxes in txtIP, txtPort, txtFirstName, txtLastName, and txtTitle.
I have found some client/server program that send message from one text box to another text box like chat program, but not different text boxes.
Thank you for your time.
1 Attachment(s)
Re: Client/Server using TCP/IP with Winsock....
It's pretty simple...
I wrote an example for you and left comments so hopefully it's not too hard to follow.
Re: Client/Server using TCP/IP with Winsock....
Oh, man!
Thank you so much, DigiRev. You are the man!
The code works great. Now, may I ask you another question. If I want the separate the txtIP into 4 different text boxes. You know like a ip address form. The txtIP(0), txtIP(1), txtIP(2), and txtIP(3) will contain only the number from 0 to 255 and. How can I do that?
Thank you again for your help.
Re: Client/Server using TCP/IP with Winsock....
In the sckClient_Connect() event:
VB Code:
strPacket = txtIP(0).Text & strSep & txtIP(1).Text & strSep & txtIP(2).Text & strSep 'etc...
Re: Client/Server using TCP/IP with Winsock....
Hi DigiRev,
I am working on the client/server programs that you wrote and modified to the way I need them to be due to the requirement for my project. I managed to get the txtIP work like the way I wanted (just like your suggestion).
I would like for you to take a look at my program and help me, if you don't mind. But I don't know how to attach the file.
Can I contact you some way some how?
Thank you very much for you help.
1 Attachment(s)
Re: Client/Server using TCP/IP with Winsock....
Oh, here is my program.
Basically, what I need to do is to send a packet from the client to the server. But before sending, I need to calculate the crc checksum first and send it. I got this part working o.k., I think.
But the other requirement is to change the first letter in the Last Name field to "Z" (Bill -> Zill) and calculate again which will be an error packet, then resend it again by using cmdSendError button. And this error packet will display on the server program on the txtError field.
Also I need to change the packet number every time I send the packet.
Would you please help me? I will really appreciate very much.
Thank you again.
Re: Client/Server using TCP/IP with Winsock....
I think you forgot to include the CRC class module.
Re: Client/Server using TCP/IP with Winsock....
I thought I did include everything in that zip file. I just download the one that I attached and it was in there. Would you please check again?
Thank you very much.
Re: Client/Server using TCP/IP with Winsock....
Nope there are no classes included in the zip.
:confused:
Maybe you could just quickly attach the class file itself? And I can put it into the folder.
Quote:
Originally Posted by VB Error
Path not found: 'N:\CNP485\CRC32\Client\clsCRC.cls'--Continue loading project?'
1 Attachment(s)
Re: Client/Server using TCP/IP with Winsock....
I'm sorry. My bad. I just checked it again and it didn't included. I don't know why but when I run the program it shows up.
Here is the class file.
Re: Client/Server using TCP/IP with Winsock....
Ok I'm not exactly sure what you're trying to do here...
When they click the Send Error packet button, you want it to change the first letter of the first name? (So the CRC fails)?
And just send that to the server and have the CRC of the error packet show up in the "Error CRC32" field?
Re: Client/Server using TCP/IP with Winsock....
Also on the Calculate CRC command button, you are putting the CRC value into the same textbox each time, so the previous one just gets overwritten.
VB Code:
Private Sub Command1_Click()
Dim OldTimer As Single
m_CRC.Algorithm = Combo1.ListIndex
txtCRC32.Text = Hex(m_CRC.CalculateString(txtFirstName.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtMajor.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtAge.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtGPA.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtGender.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtIP(0).Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtIP(1).Text))
You should build the entire packet as you would in the sckClient_Connect() event, and then perform the CRC on that entire packet.
Re: Client/Server using TCP/IP with Winsock....
Here is the requirement.
The client program must have a button on calculate and display the crc32 of the message (in hexadecimal) without actual transmitting the message. The second button will transmit the message, along with updating the crc32 value in hexadecimal on the client screen, and displaying the packet number that is sent. The client mush generate a correct crc32 checksum calculation as used by WinZip, PKZip, and the ethernet standard.
The packet number display must start at count 0 and increment with each message sent.
A button mush be provided to send an error message after the crc32 checksum has been calculated. This may be accomplished by changing the first letter in the Last Name field to Z after the crc32 checksum has been calculated.
Only one character for gender (M or F).
GPA must have two number after the decimal point (i.e. 3.95)
Thank you very much from the bottom of my heart.
Re: Client/Server using TCP/IP with Winsock....
Client Requirements
The client must transmit the following data:
Field Name---------Length------------Data Type---------Number of Bytes
------------------------------------------------------------------------
Last Name-----------20------------------String---------------20
First Name-----------20------------------String---------------20
Major----------------24------------------String---------------24
Ag--------------------1-------------------Int-----------------4
GPA-------------------1------------------Double--------------8
Gender----------------1------------------Char----------------2
Source IP-------------1------------------Unsigned int---------4
Destination IP---------1------------------Unsigned int---------4
Port Number-----------1------------------Unsigned int---------4
Packet Numbe---------1------------------Unsigned int---------4
CRC32-----------------1-----------------Unsigned int----------4
1 Attachment(s)
Re: Client/Server using TCP/IP with Winsock....
Ok. If I understand correctly, then this should be what you're wanting.
Re: Client/Server using TCP/IP with Winsock....
:thumb: :thumb: :thumb:
Thank you so much for your help and your time.
You are the most helpful person I ever found.
Now how can I solve this situation?
Quote:
Also on the Calculate CRC command button, you are putting the CRC value into the same textbox each time, so the previous one just gets overwritten.
visual basic code:Private Sub Command1_Click()
Dim OldTimer As Single
m_CRC.Algorithm = Combo1.ListIndex
txtCRC32.Text = Hex(m_CRC.CalculateString(txtFirstName.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtMajor.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtAge.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtGPA.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtGender.Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtIP(0).Text))
txtCRC32.Text = Hex(m_CRC.CalculateString(txtIP(1).Text))
You should build the entire packet as you would in the sckClient_Connect() event, and then perform the CRC on that entire packet.
I'm sure that you can make a correction easily.
1 Attachment(s)
Re: Client/Server using TCP/IP with Winsock....
Here you go.
Now if any of the info gets changed, the CRC will be different. Before, the CRC would only change if the last name was different.
Re: Client/Server using TCP/IP with Winsock....
DigiRev,
You are so smart. I wish that I were half as smart as you. You have been very nice and a great help to me. I truly appreciate it.
Thank you again.
Re: Client/Server using TCP/IP with Winsock....