Socket Connection Doc1
Socket Connection Doc1
After socket connection finding the scanner connected to the local machine using
python sane library and capture the image and save it to desktop location and then
send it to server through socket connection.
Socket:
Socket is essentially an end-point of a two-way communication link. It is identified by IP
address and the port number. The sockets should be properly configured at both ends so that it
initiates a connection, makes it possible to listen for incoming messages and then send the
responses at either ends of a client-server environment.
Methods: connect()
obj=socket.socket()
obj.connect((host,port))
obj.send(bytes)
recv():
This method is used to retrieve data sent to the client. In case of server, it uses the remote
socket whose request has been accepted.
bind():
This method binds the socket to specified IP address and port number.
listen():
This method starts server and runs into a listen loop looking for connection request from
client.
accept():
When connection request is intercepted by server, this method accepts it and identifies the
client socket with its address.
3.After receving data from client update the image to Server Database.
Once the connection is established, the client sends the data stream received
from scanner, to server for storing it in server.